diff --git a/.ci/validation.sh b/.ci/validation.sh index c96ae3eebf5..d2802a97b28 100755 --- a/.ci/validation.sh +++ b/.ci/validation.sh @@ -216,17 +216,12 @@ no-error-pmd) echo "CS_version: ${CS_POM_VERSION}" mvn -e --no-transfer-progress clean install -Pno-validations echo "Checkout target sources ..." - # checkout_from "https://github.com/pmd/build-tools.git" - checkout_from "https://github.com/kkoutsilis/build-tools.git" + checkout_from "https://github.com/pmd/build-tools.git" cd .ci-temp/build-tools/ - git ls-remote - git checkout "66d""ed33c74662cb3da612f3d34a5ae""fa""a629b443" mvn -e --no-transfer-progress install cd .. - git clone https://github.com/kkoutsilis/pmd.git + git clone https://github.com/pmd/pmd.git cd pmd - git ls-remote - git checkout "fa6a862ac8278906d7bcf21852f6552d27a46a73" ./mvnw verify --show-version --errors --batch-mode --no-transfer-progress \ -DskipTests \ -Dmaven.javadoc.skip=true \ diff --git a/.github/workflows/check-pr-description.yml b/.github/workflows/check-pr-description.yml index f280fd05c9f..7899c9ff62a 100644 --- a/.github/workflows/check-pr-description.yml +++ b/.github/workflows/check-pr-description.yml @@ -11,7 +11,7 @@ concurrency: jobs: analyze: name: Analyze - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout repository diff --git a/.github/workflows/no-old-refs.yml b/.github/workflows/no-old-refs.yml index f8c33b18bb1..e39f4c351c0 100644 --- a/.github/workflows/no-old-refs.yml +++ b/.github/workflows/no-old-refs.yml @@ -21,7 +21,7 @@ concurrency: jobs: check_issues: if: github.repository == 'checkstyle/checkstyle' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Download checkstyle uses: actions/checkout@v4 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 268808b1dab..fb54d946c64 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 @@ -28,7 +28,7 @@ concurrency: jobs: new-milestone-and-issues-in-other-repos: name: New Milestone, Create issues for ${{ inputs.version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout the latest code uses: actions/checkout@v4 diff --git a/.github/workflows/release-publish-releasenotes-twitter.yml b/.github/workflows/release-publish-releasenotes-twitter.yml index 9858e6f0531..bfe16ee8f12 100644 --- a/.github/workflows/release-publish-releasenotes-twitter.yml +++ b/.github/workflows/release-publish-releasenotes-twitter.yml @@ -24,7 +24,7 @@ concurrency: jobs: publish-releasenotes-twitter: name: Publish Release Notes on Twitter ${{ inputs.version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout the latest code uses: actions/checkout@v4 diff --git a/.github/workflows/release-update-github-page.yml b/.github/workflows/release-update-github-page.yml index a47e8b60110..f4d7139d12f 100644 --- a/.github/workflows/release-update-github-page.yml +++ b/.github/workflows/release-update-github-page.yml @@ -24,7 +24,7 @@ concurrency: jobs: update-github-page: name: Update GitHub Page ${{ inputs.version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: contents: write steps: diff --git a/.github/workflows/release-upload-all-jar.yml b/.github/workflows/release-upload-all-jar.yml index f3263b0bc96..77e7a6de5f9 100644 --- a/.github/workflows/release-upload-all-jar.yml +++ b/.github/workflows/release-upload-all-jar.yml @@ -27,7 +27,7 @@ concurrency: jobs: upload-all-jar: name: Upload '-all' jar ${{ inputs.version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout the latest code uses: actions/checkout@v4 diff --git a/.github/workflows/releasenotes-gen.yml b/.github/workflows/releasenotes-gen.yml index 702aa57ca77..2c980329ead 100644 --- a/.github/workflows/releasenotes-gen.yml +++ b/.github/workflows/releasenotes-gen.yml @@ -13,7 +13,7 @@ concurrency: jobs: generate: if: github.repository == 'checkstyle/checkstyle' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Download checkstyle uses: actions/checkout@v4 diff --git a/.github/workflows/run-link-check.yml b/.github/workflows/run-link-check.yml index d82b0f1998b..40e5ce011d2 100644 --- a/.github/workflows/run-link-check.yml +++ b/.github/workflows/run-link-check.yml @@ -18,7 +18,7 @@ concurrency: jobs: check_issues: if: github.repository == 'checkstyle/checkstyle' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Download checkstyle uses: actions/checkout@v4 diff --git a/.github/workflows/set-milestone-on-referenced-issue.yml b/.github/workflows/set-milestone-on-referenced-issue.yml index 8b7a052a87a..35c701f4338 100644 --- a/.github/workflows/set-milestone-on-referenced-issue.yml +++ b/.github/workflows/set-milestone-on-referenced-issue.yml @@ -26,7 +26,7 @@ permissions: jobs: set-milestone: if: github.repository == 'checkstyle/checkstyle' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout the latest code uses: actions/checkout@v4 diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index edf51c087e1..dd0af5db2f1 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -52,7 +52,10 @@ blocks: - .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/validation.sh nondex + # until https://github.com/checkstyle/checkstyle/issues/14086 + # - .ci/no-exception-test.sh no-exception-samples-ant + # permanently disabled as it is very unstable in execution + # - .ci/validation.sh nondex # until https://github.com/checkstyle/checkstyle/issues/9807 # - mvn -e --no-transfer-progress clean package -Passembly,no-validations # && .ci/validation.sh no-violation-test-josm diff --git a/README.md b/README.md index bd118f6d7e8..4de424ead7e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ [![][pitest img]][pitest] [![][checker framework img]][checker framework] [![][dependabot img]][dependabot] -[![][sonar img]][sonar] [![][release notes/version img]][release notes/version] [![][closed issues img]][closed issues] [![][link check img]][link check] @@ -146,9 +145,6 @@ Checkstyle uses libraries: [appveyor]:https://ci.appveyor.com/project/checkstyle/checkstyle/history [appveyor img]:https://ci.appveyor.com/api/projects/status/rw6bw3dl9kph6ucc?svg=true -[sonar]:https://sonarcloud.io/dashboard?id=org.checkstyle%3Acheckstyle -[sonar img]:https://sonarcloud.io/api/project_badges/measure?project=org.checkstyle%3Acheckstyle&metric=sqale_index - [coverage]:https://codecov.io/github/checkstyle/checkstyle?branch=master [coverage img]:https://codecov.io/github/checkstyle/checkstyle/coverage.svg?branch=master diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cf323331cac..897d0849136 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,74 +20,74 @@ strategy: matrix: # testing age of pr 'pr-age': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh pr-age" skipCache: true # spelling 'spelling': - image: 'ubuntu-22.04' + image: 'ubuntu-24.04' cmd: "./.ci/test-spelling-unknown-words.sh" skipCache: true # unit tests (openjdk11) 'test': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test" # unit tests in German locale (openjdk11) 'test-de': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-de" # unit tests in Spanish locale (openjdk11) 'test-es': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-es" # unit tests in Finnish locale (openjdk11) 'test-fi': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-fi" # unit tests in French locale (openjdk11) 'test-fr': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-fr" # unit tests in Chinese locale (openjdk11) 'test-zh': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-zh" # unit tests in Japanese locale (openjdk11) 'test-ja': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-ja" # unit tests in Portuguese locale (openjdk11) 'test-pt': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-pt" # unit tests in Turkish locale (openjdk11) 'test-tr': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-tr" # unit tests in Russian locale (openjdk11) 'test-ru': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-ru" # unit tests in Albanian locale (openjdk11) 'test-al': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh test-al" # OpenJDK11 verify 'OpenJDK11 verify': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "mvn -e --no-transfer-progress verify" # MacOS JDK11 verify @@ -100,17 +100,9 @@ strategy: image: 'macOS-14' 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 - # ensure that all modules are used in no exception configs - # 'verify-no-exception-configs': - # image: 'ubuntu-20.04' - # cmd: "./.ci/validation.sh verify-no-exception-configs" - # skipCache: true - # needXmlstarlet: true - # versions to update 'versions': - image: 'ubuntu-20.04' + image: 'ubuntu-24.04' cmd: "./.ci/validation.sh versions" onCronOnly: true diff --git a/config/checker-framework-suppressions/checker-formatter-suppressions.xml b/config/checker-framework-suppressions/checker-formatter-suppressions.xml index 345a6aa9855..0a475701581 100644 --- a/config/checker-framework-suppressions/checker-formatter-suppressions.xml +++ b/config/checker-framework-suppressions/checker-formatter-suppressions.xml @@ -7,20 +7,6 @@ final String pattern = resourceBundle.getString(key); - - src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java - format.string - invalid format string (is a @Format annotation missing?) - Locale.ROOT, PROP_DEFAULT_VALUE_MISSING, propertyName) - - - - src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java - format.string - invalid format string (is a @Format annotation missing?) - Locale.ROOT, PROP_TYPE_MISSING, propertyName) - - src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java i18nformat.key.not.found diff --git a/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml b/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml index 4214831d955..2d1113b8753 100644 --- a/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml +++ b/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml @@ -437,6 +437,9 @@ Stream.iterate(startNode.getLastChild(), Objects::nonNull,
unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object + use of T from Stream.iterate(startNode.getLastChild(), Objects::nonNull, DetailAST::getPreviousSibling) <: @GuardSatisfied Object + From complementary bound.: Objects::nonNull -> inference type: java.util.function.Predicate<? super T> + From: Argument constraint
@@ -447,6 +450,8 @@ .map(children::indexOf);
unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object + children::indexOf -> inference type: java.util.function.Function<? super com.puppycrawl.tools.checkstyle.api.DetailAST,? extends U> + From: Argument constraint
@@ -472,6 +477,9 @@ result = Stream.iterate(nonCommentAst.getPreviousSibling(),
unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object + use of T from Stream.iterate(nonCommentAst.getPreviousSibling(), Objects::nonNull, DetailAST::getPreviousSibling) <: @GuardSatisfied Object + From complementary bound.: Objects::nonNull -> inference type: java.util.function.Predicate<? super T> + From: Argument constraint
@@ -571,6 +579,9 @@ .collect(Collectors.joining(", ")),
unsatisfiable constraint: @GuardedBy String <: @GuardSatisfied Object + use of R from missingRequiredTokenNames.stream().map(String::valueOf).collect(Collectors.joining(", ")) <: @GuardSatisfied Object + From complementary bound.: use of R from missingRequiredTokenNames.stream().map(String::valueOf).collect(Collectors.joining(", ")) -> @GuardSatisfied Object + From: Constraint between method call type and target type for method call:missingRequiredTokenNames.stream().map(String::valueOf).collect(Collectors.joining(", "))
@@ -677,6 +688,9 @@ Stream.iterate(
unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object + use of T from Stream.iterate(node.getLastChild(), Objects::nonNull, DetailAST::getPreviousSibling) <: @GuardSatisfied Object + From complementary bound.: Objects::nonNull -> inference type: java.util.function.Predicate<? super T> + From: Argument constraint
@@ -1360,6 +1374,10 @@ .collect(BitSet::new, BitSet::set, BitSet::or);
unsatisfiable constraint: @GuardedBy BitSet <: @GuardSatisfied BitSet + @GuardedBy BitSet <: use of R from Arrays.stream(tokens).map(String::trim).filter(Predicate.not(String::isEmpty)).mapToInt(TokenUtil::getTokenId).collect(BitSet::new, BitSet::set, BitSet::or) + From complementary bound.: @GuardedBy BitSet -> use of R from Arrays.stream(tokens).map(String::trim).filter(Predicate.not(String::isEmpty)).mapToInt(TokenUtil::getTokenId).collect(BitSet::new, BitSet::set, BitSet::or) + BitSet::new -> inference type: java.util.function.Supplier<R> + From: Argument constraint
@@ -1370,6 +1388,10 @@ .collect(BitSet::new, BitSet::set, BitSet::or);
unsatisfiable constraint: @GuardedBy BitSet <: @GuardSatisfied BitSet + @GuardedBy BitSet <: use of R from IntStream.of(tokens).collect(BitSet::new, BitSet::set, BitSet::or) + From complementary bound.: @GuardedBy BitSet -> use of R from IntStream.of(tokens).collect(BitSet::new, BitSet::set, BitSet::or) + BitSet::new -> inference type: java.util.function.Supplier<R> + From: Argument constraint
@@ -1380,6 +1402,12 @@ .collect(Collectors.toUnmodifiableMap(
unsatisfiable constraint: @GuardedBy Field <: @GuardSatisfied Field + @GuardedBy Field <: use of T from Collectors.toUnmodifiableMap(Field::getName, (fld)->getIntFromField(fld, null)) + From complementary bound.: @GuardedBy Field <: use of captured T from Collectors.toUnmodifiableMap(Field::getName, (fld)->getIntFromField(fld, null)) + From complementary bound.: use of captured T from Collectors.toUnmodifiableMap(Field::getName, (fld)->getIntFromField(fld, null)) <= ? extends @GuardedBy Object super @GuardedBy Field + inference type: java.util.stream.Collector<T,A,R> <: inference type: java.util.stream.Collector<? super java.lang.reflect.Field,A,R> + inference type: java.util.stream.Collector<T,A,R> -> inference type: java.util.stream.Collector<? super java.lang.reflect.Field,A,R> + From: Captured constraint from method call: Collectors.toUnmodifiableMap(Field::getName, (fld)->getIntFromField(fld, null))
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 ada00f50579..cdfd767131e 100644 --- a/config/checker-framework-suppressions/checker-methods-resource-fenum-suppressions.xml +++ b/config/checker-framework-suppressions/checker-methods-resource-fenum-suppressions.xml @@ -3,23 +3,15 @@ src/main/java/com/puppycrawl/tools/checkstyle/Main.java required.method.not.called - @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: regular method exit -
+ (required.method.not.called) + final OutputStream out = getOutputStream(outputLocation);
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); -
- 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 -
+ (required.method.not.called) + listener = new XpathFileGeneratorAuditListener(getOutputStream(options.outputPath),
@@ -36,111 +28,71 @@ 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. + (required.method.not.called) final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName); -
- The type of object is: java.io.InputStream. - 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 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: possible exceptional exit due to new SarifLogger(Files.newOutputStream(toFile.toPath()), OutputStreamOptions.CLOSE) with exception type java.io.IOException -
+ (required.method.not.called) + final OutputStream debug = new LogOutputStream(this, Project.MSG_DEBUG);
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @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 -
+ (required.method.not.called) + final OutputStream err = new LogOutputStream(this, Project.MSG_ERR);
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); -
- The type of object is: java.io.OutputStream. - Reason for going out of scope: regular method exit -
+ (required.method.not.called) + final OutputStream infoStream = Files.newOutputStream(toFile.toPath());
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); -
- The type of object is: java.io.OutputStream. - Reason for going out of scope: regular method exit -
+ (required.method.not.called) + new LogOutputStream(task, Project.MSG_DEBUG),
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()); -
- The type of object is: java.io.OutputStream. - Reason for going out of scope: regular method exit -
+ (required.method.not.called) + new LogOutputStream(task, Project.MSG_ERR),
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @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: regular method exit -
+ (required.method.not.called) + sarifLogger = new SarifLogger(Files.newOutputStream(toFile.toPath()),
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @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 -
+ (required.method.not.called) + sarifLogger = new SarifLogger(new LogOutputStream(task, Project.MSG_INFO),
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @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: possible exceptional exit due to new SarifLogger(new LogOutputStream(task, Project.MSG_INFO), OutputStreamOptions.CLOSE) with exception type java.io.IOException -
+ (required.method.not.called) + xmlLogger = new XMLLogger(Files.newOutputStream(toFile.toPath()),
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on new LogOutputStream(task, Project.MSG_INFO) or any of its aliases. + (required.method.not.called) xmlLogger = new XMLLogger(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 -
@@ -168,12 +120,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java required.method.not.called - @MustCall method close may not have been invoked on XmlMetaReader.class.getResourceAsStream("/" + fileName) or any of its aliases. + (required.method.not.called) 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 -
@@ -198,6 +146,8 @@ .map(Pattern.class::cast)
unsatisfiable constraint: capture extends @FenumTop Object <: @FenumUnqualified Object + Pattern.class::cast -> inference type: java.util.function.Function<? super capture of ?,? extends R> + From: Argument constraint
@@ -208,18 +158,16 @@ .map(String.class::cast)
unsatisfiable constraint: capture extends @FenumTop Object <: @FenumUnqualified Object + String.class::cast -> inference type: java.util.function.Function<? super capture of ?,? extends R> + From: Argument constraint
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. + (required.method.not.called) 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 -
@@ -229,160 +177,106 @@ .map(elementType::cast)
unsatisfiable constraint: S extends @FenumTop Object <: @FenumUnqualified Object + elementType::cast -> inference type: java.util.function.Function<? super S,? extends R> + From: Argument constraint
src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java required.method.not.called - @MustCall method close may not have been invoked on axisIterator or any of its aliases. + (required.method.not.called) AxisIterator axisIterator = iterateAxis(axisNumber); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: variable overwritten by assignment axisIterator = new Navigator.AxisFilter(axisIterator, nodeTest) -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on SingleNodeIterator.makeIterator(start) or any of its aliases. + (required.method.not.called) descendantEnum = SingleNodeIterator.makeIterator(start); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on queue.poll().iterateAxis(AxisInfo.CHILD) or any of its aliases. + (required.method.not.called) descendantEnum = queue.poll().iterateAxis(AxisInfo.CHILD); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.CHILD) or any of its aliases. + (required.method.not.called) descendantEnum = start.iterateAxis(AxisInfo.CHILD); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @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 -
+ (required.method.not.called) + ancestorEnum = start.iterateAxis(AxisInfo.ANCESTOR);
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @MustCall method close may not have been invoked on result.iterateAxis(AxisInfo.DESCENDANT) or any of its aliases. + (required.method.not.called) descendantEnum = result.iterateAxis(AxisInfo.DESCENDANT); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @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 -
+ (required.method.not.called) + siblingEnum = parent.iterateAxis(AxisInfo.FOLLOWING_SIBLING);
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.FOLLOWING_SIBLING) or any of its aliases. + (required.method.not.called) siblingEnum = start.iterateAxis(AxisInfo.FOLLOWING_SIBLING); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @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. - Reason for going out of scope: regular method exit -
+ (required.method.not.called) + ancestorEnum = start.iterateAxis(AxisInfo.ANCESTOR);
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @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 -
+ (required.method.not.called) + descendantEnum = new ReverseDescendantIterator(result);
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @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 -
+ (required.method.not.called) + previousSiblingEnum = result.iterateAxis(AxisInfo.PRECEDING_SIBLING);
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.PRECEDING_SIBLING) or any of its aliases. + (required.method.not.called) previousSiblingEnum = start.iterateAxis(AxisInfo.PRECEDING_SIBLING); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseDescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on queue.poll().iterateAxis(AxisInfo.CHILD) or any of its aliases. + (required.method.not.called) pushToStack(queue.poll().iterateAxis(AxisInfo.CHILD)); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseDescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.CHILD) or any of its aliases. + (required.method.not.called) pushToStack(start.iterateAxis(AxisInfo.CHILD)); -
- The type of object is: net.sf.saxon.tree.iter.AxisIterator. - Reason for going out of scope: regular method exit -
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 29a15bb2ad7..83eba136292 100644 --- a/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml +++ b/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml @@ -793,6 +793,10 @@ .collect(Collectors.groupingBy(Class::getSimpleName,
unsatisfiable constraint: @Initialized @Nullable String <: @Initialized @NonNull String + @Initialized @Nullable String <: use of U from Collectors.mapping(Class::getCanonicalName, Collectors.toCollection(HashSet::new)) + From complementary bound.: @Initialized @Nullable String -> use of U from Collectors.mapping(Class::getCanonicalName, Collectors.toCollection(HashSet::new)) + Class::getCanonicalName -> inference type: java.util.function.Function<? super java.lang.Class<?>,? extends U> + From: Argument constraint
@@ -1134,7 +1138,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java initialization.field.uninitialized the default constructor does not initialize field properties - private File properties; + private Path properties; @@ -2801,6 +2805,11 @@ return new SimpleEntry<>(variableUsageAst, dist);
unsatisfiable constraint: @Initialized @Nullable DetailAST <: @Initialized @NonNull DetailAST + use of K from new SimpleEntry<>(variableUsageAst, dist) <: @Initialized @NonNull DetailAST + From complementary bound.: use of K from new SimpleEntry<>(variableUsageAst, dist) <= @Initialized @NonNull DetailAST + inference type: java.util.AbstractMap.SimpleEntry<K,V> <: @Initialized @NonNull Entry<@Initialized @NonNull DetailAST, @Initialized @NonNull Integer> + inference type: java.util.AbstractMap.SimpleEntry<K,V> -> @Initialized @NonNull Entry<@Initialized @NonNull DetailAST, @Initialized @NonNull Integer> + From: Constraint between method call type and target type for method call:new SimpleEntry<>(variableUsageAst, dist)
@@ -2811,6 +2820,11 @@ return new SimpleEntry<>(variableUsageAst, dist);
unsatisfiable constraint: @Initialized @Nullable DetailAST <: @Initialized @NonNull DetailAST + use of K from new SimpleEntry<>(variableUsageAst, dist) <: @Initialized @NonNull DetailAST + From complementary bound.: use of K from new SimpleEntry<>(variableUsageAst, dist) <= @Initialized @NonNull DetailAST + inference type: java.util.AbstractMap.SimpleEntry<K,V> <: @Initialized @NonNull Entry<@Initialized @NonNull DetailAST, @Initialized @NonNull Integer> + inference type: java.util.AbstractMap.SimpleEntry<K,V> -> @Initialized @NonNull Entry<@Initialized @NonNull DetailAST, @Initialized @NonNull Integer> + From: Constraint between method call type and target type for method call:new SimpleEntry<>(variableUsageAst, dist)
@@ -5523,6 +5537,12 @@ .collect(Collectors.toUnmodifiableList());
unsatisfiable constraint: @Initialized @PolyNull AbstractNode <: @Initialized @NonNull AbstractNode + use of T from Collectors.toUnmodifiableList() = @Initialized @NonNull AbstractNode + From complementary bound.: use of T from Collectors.toUnmodifiableList() <= @Initialized @NonNull AbstractNode + inference type: java.util.List<T> <: @UnknownInitialization @Nullable List<@Initialized @NonNull AbstractNode> + use of R from getItems(event).stream().map(AbstractNode.class::cast).collect(Collectors.toUnmodifiableList()) <: @UnknownInitialization @Nullable List<@Initialized @NonNull AbstractNode> + From complementary bound.: use of R from getItems(event).stream().map(AbstractNode.class::cast).collect(Collectors.toUnmodifiableList()) -> @UnknownInitialization @Nullable List<@Initialized @NonNull AbstractNode> + From: Constraint between method call type and target type for method call:getItems(event).stream().map(AbstractNode.class::cast).collect(Collectors.toUnmodifiableList())
@@ -5902,6 +5922,8 @@ .map(ElementNode::getUnderlyingNode)
unsatisfiable constraint: @Initialized @PolyNull ElementNode <: @Initialized @NonNull ElementNode + ElementNode::getUnderlyingNode -> inference type: java.util.function.Function<? super com.puppycrawl.tools.checkstyle.xpath.ElementNode,? extends R> + From: Argument constraint
@@ -6334,6 +6356,8 @@ .map(Pattern.class::cast)
unsatisfiable constraint: capture extends @Initialized @Nullable Object <: @Initialized @PolyNull Object + Pattern.class::cast -> inference type: java.util.function.Function<? super capture of ?,? extends R> + From: Argument constraint
@@ -6344,6 +6368,8 @@ .map(String.class::cast)
unsatisfiable constraint: capture extends @Initialized @Nullable Object <: @Initialized @PolyNull Object + String.class::cast -> inference type: java.util.function.Function<? super capture of ?,? extends R> + From: Argument constraint
@@ -6593,7 +6619,20 @@ 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 + unsatisfiable constraint: K extends @Initialized @Nullable Object <: @Initialized @NonNull Object + capture extends K extends @Initialized @Nullable Object <: use of K from Map.copyOf(map) + From complementary bound.: capture extends K extends @Initialized @Nullable Object <= inference type: ? extends K + @Initialized @NonNull Map<capture extends K extends @Initialized @Nullable Object, capture extends V extends @Initialized @Nullable Object> <: inference type: java.util.Map<? extends K,? extends V> + @Initialized @NonNull Map<capture extends K extends @Initialized @Nullable Object, capture extends V extends @Initialized @Nullable Object> -> inference type: java.util.Map<? extends K,? extends V> + map -> inference type: java.util.Map<? extends K,? extends V> + From: Argument constraint + V extends @Initialized @Nullable Object <: @Initialized @NonNull Object + capture extends V extends @Initialized @Nullable Object <: use of V from Map.copyOf(map) + From complementary bound.: capture extends V extends @Initialized @Nullable Object <= inference type: ? extends V + @Initialized @NonNull Map<capture extends K extends @Initialized @Nullable Object, capture extends V extends @Initialized @Nullable Object> <: inference type: java.util.Map<? extends K,? extends V> + @Initialized @NonNull Map<capture extends K extends @Initialized @Nullable Object, capture extends V extends @Initialized @Nullable Object> -> inference type: java.util.Map<? extends K,? extends V> + map -> inference type: java.util.Map<? extends K,? extends V> + From: Argument constraint
@@ -6604,6 +6643,12 @@ .collect(Collectors.toUnmodifiableList());
unsatisfiable constraint: T extends @Initialized @PolyNull Object <: T extends @Initialized @Nullable Object + use of T from Collectors.toUnmodifiableList() = T extends @Initialized @Nullable Object + From complementary bound.: use of T from Collectors.toUnmodifiableList() <= T extends @Initialized @Nullable Object + inference type: java.util.List<T> <: @Initialized @NonNull List<T extends @Initialized @Nullable Object> + use of R from items.stream().map(elementType::cast).collect(Collectors.toUnmodifiableList()) <: @Initialized @NonNull List<T extends @Initialized @Nullable Object> + From complementary bound.: use of R from items.stream().map(elementType::cast).collect(Collectors.toUnmodifiableList()) -> @Initialized @NonNull List<T extends @Initialized @Nullable Object> + From: Constraint between method call type and target type for method call:items.stream().map(elementType::cast).collect(Collectors.toUnmodifiableList())
diff --git a/config/checkstyle-examples-suppressions.xml b/config/checkstyle-examples-suppressions.xml index 11993f2a64c..8db5cbd2e1e 100644 --- a/config/checkstyle-examples-suppressions.xml +++ b/config/checkstyle-examples-suppressions.xml @@ -138,6 +138,10 @@ + + + diff --git a/config/checkstyle-resources-suppressions.xml b/config/checkstyle-resources-suppressions.xml index 6f8ab7f70ca..8c1a966220d 100644 --- a/config/checkstyle-resources-suppressions.xml +++ b/config/checkstyle-resources-suppressions.xml @@ -278,48 +278,6 @@ files="[\\/]test[\\/]resources[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]checks[\\/]avoidescapedunicodecharacters[\\/]InputAvoidEscapedUnicodeCharacters2\.java"/> - - - - - - - - - - - - - - - - - - - - - - - JavadocNodeImpl.java - ArrayHashCode - hashcode method on array does not hash array contents - + ", children=" + Objects.hashCode(children) - PropertiesMacro.java diff --git a/config/import-control.xml b/config/import-control.xml index 786abebfb44..2fb1b32a74d 100644 --- a/config/import-control.xml +++ b/config/import-control.xml @@ -4,7 +4,7 @@ "https://checkstyle.org/dtds/import_control_1_4.dtd"> - + diff --git a/config/jsoref-spellchecker/whitelist.words b/config/jsoref-spellchecker/whitelist.words index 6af2a2121b6..70d82ebf46c 100644 --- a/config/jsoref-spellchecker/whitelist.words +++ b/config/jsoref-spellchecker/whitelist.words @@ -88,7 +88,6 @@ Awarns aws awt azurewebsites -backport Backquote backticks BADN @@ -456,7 +455,6 @@ FIXME Fjava Fjavadoc Flas -flattr fluido Fmain Fmessages @@ -468,7 +466,6 @@ forbiddenapis Foreach Fpuppycrawl fq -freedomsponsors freemarker Fregexp Fresources @@ -746,7 +743,6 @@ KDoc keygen keyname keyscan -kkoutsilis konstantinos Kordas Kotlin @@ -1251,7 +1247,6 @@ spotbugs spotbugsreports spotify springframework -sqale sqe sql src diff --git a/config/pitest-suppressions/pitest-ant-suppressions.xml b/config/pitest-suppressions/pitest-ant-suppressions.xml index 4056a74e419..07a108e6334 100644 --- a/config/pitest-suppressions/pitest-ant-suppressions.xml +++ b/config/pitest-suppressions/pitest-ant-suppressions.xml @@ -1,14 +1,5 @@ - - CheckstyleAntTask.java - com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable maxWarnings - private int maxWarnings = Integer.MAX_VALUE; - - CheckstyleAntTask.java com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask @@ -57,19 +48,19 @@ CheckstyleAntTask.java com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask - createRootModule + createOverridingProperties org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/Package::getName - Checker.class.getPackage().getName() + ".", moduleClassLoader); + removed call to java/lang/String::valueOf + throw new BuildException("Error loading Properties file '" CheckstyleAntTask.java com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask createRootModule - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/lang/String::format with argument - throw new BuildException(String.format(Locale.ROOT, "Unable to create Root Module: " + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/Package::getName + Checker.class.getPackage().getName() + ".", moduleClassLoader); @@ -90,15 +81,6 @@ final int formatterCount = Math.max(1, formatters.size()); - - CheckstyleAntTask.java - com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask - getListeners - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/lang/String::format with argument - throw new BuildException(String.format(Locale.ROOT, "Unable to create listeners: " - - CheckstyleAntTask.java com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask @@ -113,8 +95,8 @@ com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask processFiles org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask::getLocation - throw new BuildException(failureMsg, getLocation()); + removed call to java/lang/String::valueOf + throw new BuildException("Unable to process files: " + files, ex); @@ -125,4 +107,13 @@ removed call to java/lang/Integer::valueOf logIndex, fileNames.length, scanner.getBasedir()), Project.MSG_VERBOSE); + + + CheckstyleAntTask.java + com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask + scanPath + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + log(pathIndex + ") Scanning path " + path, Project.MSG_VERBOSE); + diff --git a/config/pitest-suppressions/pitest-coding-1-suppressions.xml b/config/pitest-suppressions/pitest-coding-1-suppressions.xml index 564e522b55e..4bb57192e56 100644 --- a/config/pitest-suppressions/pitest-coding-1-suppressions.xml +++ b/config/pitest-suppressions/pitest-coding-1-suppressions.xml @@ -1,47 +1,3 @@ - - 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 894830e692b..443148c5511 100644 --- a/config/pitest-suppressions/pitest-coding-2-suppressions.xml +++ b/config/pitest-suppressions/pitest-coding-2-suppressions.xml @@ -1,6 +1,32 @@ - + + IllegalInstantiationCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiationCheck + visitToken + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new IllegalArgumentException("Unknown type " + ast); + + + + ModifiedControlVariableCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.ModifiedControlVariableCheck + leaveToken + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new IllegalStateException(ILLEGAL_TYPE_OF_TOKEN + ast); + + + + ModifiedControlVariableCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.ModifiedControlVariableCheck + visitToken + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new IllegalStateException(ILLEGAL_TYPE_OF_TOKEN + ast); + + UnusedLocalVariableCheck.java com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck diff --git a/config/pitest-suppressions/pitest-filters-suppressions.xml b/config/pitest-suppressions/pitest-filters-suppressions.xml index f2284e658c5..ba16ef33f6b 100644 --- a/config/pitest-suppressions/pitest-filters-suppressions.xml +++ b/config/pitest-suppressions/pitest-filters-suppressions.xml @@ -108,6 +108,15 @@ tagMessageRegexp = null; + + SuppressWithNearbyCommentFilter.java + com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter$Tag + toString + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + return "Tag[text='" + text + '\'' + + SuppressWithPlainTextCommentFilter.java com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter$Suppression @@ -144,6 +153,15 @@ tagMessageRegexp = null; + + SuppressionCommentFilter.java + com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter$Tag + toString + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + return "Tag[text='" + text + '\'' + + XpathFilterElement.java com.puppycrawl.tools.checkstyle.filters.XpathFilterElement diff --git a/config/pitest-suppressions/pitest-header-suppressions.xml b/config/pitest-suppressions/pitest-header-suppressions.xml new file mode 100644 index 00000000000..75a8c87592f --- /dev/null +++ b/config/pitest-suppressions/pitest-header-suppressions.xml @@ -0,0 +1,11 @@ + + + + AbstractHeaderCheck.java + com.puppycrawl.tools.checkstyle.checks.header.AbstractHeaderCheck + loadHeaderFile + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new CheckstyleException( + + diff --git a/config/pitest-suppressions/pitest-imports-suppressions.xml b/config/pitest-suppressions/pitest-imports-suppressions.xml index 1737714a513..318834a41a6 100644 --- a/config/pitest-suppressions/pitest-imports-suppressions.xml +++ b/config/pitest-suppressions/pitest-imports-suppressions.xml @@ -1,5 +1,50 @@ + + ImportControlCheck.java + com.puppycrawl.tools.checkstyle.checks.imports.ImportControlCheck + setFile + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new IllegalArgumentException(UNABLE_TO_LOAD + uri, ex); + + + + ImportControlLoader.java + com.puppycrawl.tools.checkstyle.checks.imports.ImportControlLoader + load + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new CheckstyleException("unable to read " + uri, ex); + + + + ImportControlLoader.java + com.puppycrawl.tools.checkstyle.checks.imports.ImportControlLoader + loadUri + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new CheckstyleException("syntax error in url " + uri, ex); + + + + ImportControlLoader.java + com.puppycrawl.tools.checkstyle.checks.imports.ImportControlLoader + loadUri + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new CheckstyleException("unable to find " + uri, ex); + + + + ImportOrderCheck.java + com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck + visitToken + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new IllegalStateException( + + PkgImportControl.java com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl diff --git a/config/pitest-suppressions/pitest-javadoc-suppressions.xml b/config/pitest-suppressions/pitest-javadoc-suppressions.xml index 4332970ee6b..ce2a86d468a 100644 --- a/config/pitest-suppressions/pitest-javadoc-suppressions.xml +++ b/config/pitest-suppressions/pitest-javadoc-suppressions.xml @@ -5,8 +5,8 @@ com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl toString org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/Objects::hashCode - + ", children=" + Objects.hashCode(children) + removed call to java/lang/String::valueOf + + ", children=" + Arrays.hashCode(children) diff --git a/config/pitest-suppressions/pitest-packagenamesloader-suppressions.xml b/config/pitest-suppressions/pitest-packagenamesloader-suppressions.xml new file mode 100644 index 00000000000..8f2d5af8af6 --- /dev/null +++ b/config/pitest-suppressions/pitest-packagenamesloader-suppressions.xml @@ -0,0 +1,11 @@ + + + + PackageNamesLoader.java + com.puppycrawl.tools.checkstyle.PackageNamesLoader + processFile + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to java/lang/String::valueOf + throw new CheckstyleException("unable to open " + packageFile, ex); + + diff --git a/config/pitest-suppressions/pitest-tree-walker-suppressions.xml b/config/pitest-suppressions/pitest-tree-walker-suppressions.xml index 5863d23fdeb..3cbdcc4d5f4 100644 --- a/config/pitest-suppressions/pitest-tree-walker-suppressions.xml +++ b/config/pitest-suppressions/pitest-tree-walker-suppressions.xml @@ -1,32 +1,5 @@ - - DetailNodeTreeStringPrinter.java - com.puppycrawl.tools.checkstyle.DetailNodeTreeStringPrinter - parseFile - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/nio/charset/Charset::name - System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); - - - - DetailNodeTreeStringPrinter.java - com.puppycrawl.tools.checkstyle.DetailNodeTreeStringPrinter - parseFile - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/lang/System::getProperty with argument - System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); - - - - DetailNodeTreeStringPrinter.java - com.puppycrawl.tools.checkstyle.DetailNodeTreeStringPrinter - 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(), - - JavadocDetailNodeParser.java com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser @@ -36,24 +9,6 @@ htmlTagNameStart = stack.pop(); - - SuppressionsStringPrinter.java - com.puppycrawl.tools.checkstyle.SuppressionsStringPrinter - printSuppressions - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/nio/charset/Charset::name - System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); - - - - SuppressionsStringPrinter.java - com.puppycrawl.tools.checkstyle.SuppressionsStringPrinter - printSuppressions - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/lang/System::getProperty with argument - System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); - - TreeWalker.java com.puppycrawl.tools.checkstyle.TreeWalker diff --git a/config/spotbugs-exclude.xml b/config/spotbugs-exclude.xml index 8b582575093..e5d5ef36a5a 100644 --- a/config/spotbugs-exclude.xml +++ b/config/spotbugs-exclude.xml @@ -325,14 +325,4 @@ - - - - - - - - - - diff --git a/config/suppressions.xml b/config/suppressions.xml index aa1ca151aba..dac2ee5d870 100644 --- a/config/suppressions.xml +++ b/config/suppressions.xml @@ -114,7 +114,6 @@ - @@ -125,7 +124,6 @@ - diff --git a/docs/GRAMMAR_UPDATES.md b/docs/GRAMMAR_UPDATES.md index 0ae278ff0d5..a0932075074 100644 --- a/docs/GRAMMAR_UPDATES.md +++ b/docs/GRAMMAR_UPDATES.md @@ -152,7 +152,7 @@ have updated TokenTypes to include `LITERAL_WHEN`. At this point, we are able to parse the new syntax, however, the new tokens will not appear in the AST unless we update the JavaAstVisitor. This is because our ANTLR grammar -provides us with a parse tree, which we use the JavaAstVisitor to traverse and build our AST. +provides us with a parse tree, which we traverse using the JavaAstVisitor to build our AST. ```java @Override diff --git a/pom.xml b/pom.xml index 117762d3e6f..ce96b2eac75 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ com.puppycrawl.tools checkstyle - 10.23.0 + 10.23.1 jar checkstyle @@ -210,8 +210,8 @@ 3.21.0 4.9.3.0 3.26.0 - 7.12.0 - 0.8.12 + 7.13.0 + 0.8.13 5.2.0 12.5 3.6.0 @@ -223,7 +223,7 @@ 3.14.0 11 ${java.version} - 1.19.0 + 1.19.1 10 HTML,XML 50000 @@ -231,10 +231,10 @@ 1.2.2 1.0.6 **/test/resources/**/*,**/it/resources/**/* - 5.12.1 - 3.8 + 5.12.2 + 3.9 1.2.0 - 3.49.1 + 3.49.2 2.31.0 0.15.0 1.12.0 @@ -287,7 +287,7 @@ info.picocli picocli - 4.7.6 + 4.7.7 org.antlr @@ -308,7 +308,7 @@ com.google.guava guava - 33.4.6-jre + 33.4.8-jre org.checkerframework @@ -386,7 +386,7 @@ nl.jqno.equalsverifier equalsverifier - 3.19.2 + 3.19.3 test @@ -398,7 +398,7 @@ commons-io commons-io - 2.18.0 + 2.19.0 test @@ -2133,10 +2133,6 @@ https://twitter.com/checkstyle_java/ - - https://flattr.com/submit/ - - https://button.flattr.com/flattr-badge-large.png http://tide.olympe.in/* http://dl.acm.org/* @@ -2175,8 +2171,6 @@ https://opencollective.com/* https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - https://freedomsponsors.org/* https://liberapay.com/checkstyle/ @@ -2801,7 +2795,6 @@ - org.checkerframework.checker.formatter.FormatterChecker org.checkerframework.checker.i18nformatter.I18nFormatterChecker 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 c247c0a098e..aa4e58cc652 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 @@ -70,17 +70,17 @@ public void testing(Object o1, Object o2) { System.out.println("done"); } - { - 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(); - } + { + 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(); + } + } int x = o1 instanceof String aaa$aaa ? aaa$aaa.length() : 2; // violation above 'Pattern variable name .* must match pattern' diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputTryCatchIfElse.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputTryCatchIfElse.java index 92601bda293..66c693cf1cb 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputTryCatchIfElse.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputTryCatchIfElse.java @@ -34,20 +34,34 @@ void foo() throws Exception { try (MyResource r = new MyResource()) {} try (MyResource r = new MyResource()) {} catch (Exception expected) {} + // 2 violations above: + // 'WhitespaceAround: '{' is not followed by whitespace.' + // ''}' at column 74 should be alone on a line.' try (MyResource r = new MyResource()) {} catch (Exception expected) { } - // violation above 'Empty blocks should have no spaces.' + // 3 violations above: + // 'Empty blocks should have no spaces.' + // 'WhitespaceAround: '{' is not followed by whitespace.' + // ''}' at column 75 should be alone on a line.' try (MyResource r = new MyResource()) { } catch (Exception expected) {} + // violation above ''}' at column 35 should be alone on a line.' try (MyResource r = new MyResource()) { - // violation below 'Empty blocks should have no spaces.' } catch (Exception expected) { } + // 2 violations above: + // 'Empty blocks should have no spaces.' + // ''}' at column 36 should be alone on a line.' try (MyResource r = new MyResource()) { ; } // violation above ''{' at column 43 should have line break after.' + try { + /* foo */ + // violation below ''}' at column 35 should be alone on a line.' + } catch (Exception expected) {} + try { /* foo */ // violation below ''}' at column 5 should be on the same line as .* multi-block statement' 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 index 0e8b484dcb2..08fc4a67243 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocks.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocks.java @@ -50,17 +50,29 @@ void foo() throws Exception { try (MyResource r = new MyResource()) { } // violation above 'Empty blocks should have no spaces. .* may only be represented as {}' try (MyResource r = new MyResource()) {} + try (MyResource r = new MyResource()) {} catch (Exception expected) {} - // false-negative above until #15792 + // 2 violations above: + // 'WhitespaceAround: '{' is not followed by whitespace.' + // ''}' at column 74 should be alone on a line.' + try (MyResource r = new MyResource()) {} catch (Exception expected) { } - // violation above 'Empty blocks should have no spaces. .* may only be represented as {}' + // 3 violations above: + // 'Empty blocks should have no spaces.' + // 'WhitespaceAround: '{' is not followed by whitespace.' + // ''}' at column 75 should be alone on a line.' + try (MyResource r = new MyResource()) { - } catch (Exception expected) {} // false-negative until #15792 + } catch (Exception expected) {} + // violation above ''}' at column 35 should be alone on a line.' try (MyResource r = new MyResource()) { } catch (Exception expected) { } - // violation above 'Empty blocks should have no spaces. .* may only be represented as {}' + // 2 violations above: + // 'Empty blocks should have no spaces.' + // ''}' at column 36 should be alone on a line.' + try (MyResource r = new MyResource()) {;} // 3 violations above: // 'WhitespaceAround: '{' is not followed by whitespace.' 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 index 20fa86f0a65..98444f24804 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectJavadocParagraph.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectJavadocParagraph.java @@ -105,7 +105,6 @@ boolean emulated() { * @see Documentation about *

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

tag should be preceded with an empty line.' boolean emulated() { return false; } @@ -136,9 +135,6 @@ class InnerPrecedingPtag { *

  • 1 should NOT give violation as there is not empty line before * */ - // 2 violations 4 lines above: - // '

    tag should be placed immediately before the first word' - // '

    tag should be preceded with an empty line.' public void foo() {} // 2 violations 6 lines below: 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 index d110e44e6f1..874750e8c00 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraph.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraph.java @@ -116,9 +116,6 @@ boolean emulated() { * * @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/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java b/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java index 2625609d2a0..a1b05efbfd5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseErrorMessage; import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseStatus; @@ -169,8 +168,7 @@ private static String getIndentation(DetailNode node) { * @throws IOException if the file could not be read. */ private static DetailNode parseFile(File file) throws IOException { - final FileText text = new FileText(file.getAbsoluteFile(), - System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); + final FileText text = new FileText(file, System.getProperty("file.encoding")); return parseJavadocAsDetailNode(text.getFullText().toString()); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java index c2a0d6095e3..0840459360c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java @@ -19,13 +19,13 @@ package com.puppycrawl.tools.checkstyle; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Optional; import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.stream.Collectors; import org.antlr.v4.runtime.BufferedTokenStream; @@ -1593,7 +1593,7 @@ public DetailAstImpl visitBinOp(JavaLanguageParser.BinOpContext ctx) { // operation final Queue descendantList = binOpList.parallelStream() .map(this::getInnerBopAst) - .collect(Collectors.toCollection(ConcurrentLinkedQueue::new)); + .collect(Collectors.toCollection(ArrayDeque::new)); bop.addChild(descendantList.poll()); DetailAstImpl pointer = bop.getFirstChild(); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java index 123e1875be2..e1bfca45620 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java @@ -134,7 +134,7 @@ else if (parseResult.isUsageHelpRequested()) { catch (ParameterException ex) { exitStatus = EXIT_WITH_INVALID_USER_INPUT_CODE; System.err.println(ex.getMessage()); - System.err.println("Usage: checkstyle [OPTIONS]... FILES..."); + System.err.println("Usage: checkstyle [OPTIONS]... file(s) or folder(s) ..."); System.err.println("Try 'checkstyle --help' for more information."); } catch (CheckstyleException ex) { @@ -666,7 +666,8 @@ private static final class CliOptions { private static final int TREE_WALKER_THREADS_NUMBER = DEFAULT_THREAD_COUNT; /** List of file to validate. */ - @Parameters(arity = "1..*", description = "One or more source files to verify") + @Parameters(arity = "1..*", paramLabel = "", + description = "One or more source files to verify") private List files; /** Config file location. */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java b/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java index f1940daa616..158d386c3fc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Locale; import java.util.regex.Matcher; @@ -73,8 +72,7 @@ public static String printSuppressions(File file, String suppressionLineColumnNu throw new IllegalStateException(exceptionMsg); } - final FileText fileText = new FileText(file, - System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); + final FileText fileText = new FileText(file, System.getProperty("file.encoding")); final DetailAST detailAST = JavaParser.parseFileText(fileText, JavaParser.Options.WITH_COMMENTS); final int lineNumber = Integer.parseInt(matcher.group(1)); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java b/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java index d2791f5bb12..0810c0756ac 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java @@ -26,9 +26,9 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.AuditListener; @@ -62,7 +62,7 @@ public class XMLLogger /** Holds all messages for the given file. */ private final Map fileMessages = - new ConcurrentHashMap<>(); + new HashMap<>(); /** * Helper writer that allows easy encoding and printing. @@ -184,12 +184,12 @@ private void writeFileClosingTag() { public void addError(AuditEvent event) { if (event.getSeverityLevel() != SeverityLevel.IGNORE) { final String fileName = event.getFileName(); - if (fileName == null || !fileMessages.containsKey(fileName)) { - writeFileError(event); + final FileMessages messages = fileMessages.get(fileName); + if (messages != null) { + messages.addError(event); } else { - final FileMessages messages = fileMessages.get(fileName); - messages.addError(event); + writeFileError(event); } } } @@ -225,12 +225,12 @@ private void writeFileError(AuditEvent event) { @Override public void addException(AuditEvent event, Throwable throwable) { final String fileName = event.getFileName(); - if (fileName == null || !fileMessages.containsKey(fileName)) { - writeException(throwable); + final FileMessages messages = fileMessages.get(fileName); + if (messages != null) { + messages.addException(throwable); } else { - final FileMessages messages = fileMessages.get(fileName); - messages.addException(throwable); + writeException(throwable); } } 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 78ebc7047cb..a441afde5d4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java @@ -24,6 +24,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -35,12 +36,12 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.FileScanner; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Path; import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; import com.puppycrawl.tools.checkstyle.Checker; @@ -76,7 +77,7 @@ public class CheckstyleAntTask extends Task { private static final String TIME_SUFFIX = " ms."; /** Contains the paths to process. */ - private final List paths = new ArrayList<>(); + private final List paths = new ArrayList<>(); /** Contains the filesets to process. */ private final List fileSets = new ArrayList<>(); @@ -100,7 +101,7 @@ public class CheckstyleAntTask extends Task { private String failureProperty; /** The name of the properties file. */ - private File properties; + private Path properties; /** The maximum number of errors that are tolerated. */ private int maxErrors; @@ -163,7 +164,7 @@ public void setMaxWarnings(int maxWarnings) { * * @param path the path to add. */ - public void addPath(Path path) { + public void addPath(org.apache.tools.ant.types.Path path) { paths.add(path); } @@ -204,8 +205,8 @@ public void addProperty(Property property) { * @noinspectionreason DeprecatedIsStillUsed - until #12556 */ @Deprecated(since = "10.7.0") - public Path createClasspath() { - return new Path(getProject()); + public org.apache.tools.ant.types.Path createClasspath() { + return new org.apache.tools.ant.types.Path(getProject()); } /** @@ -250,7 +251,7 @@ public void setExecuteIgnoredModules(boolean omit) { * @param props the properties File to use */ public void setProperties(File props) { - properties = props; + properties = props.toPath(); } //////////////////////////////////////////////////////////////////////////// @@ -420,7 +421,7 @@ private Properties createOverridingProperties() { // Load the properties file if specified if (properties != null) { - try (InputStream inStream = Files.newInputStream(properties.toPath())) { + try (InputStream inStream = Files.newInputStream(properties)) { returnValue.load(inStream); } catch (final IOException ex) { @@ -488,14 +489,16 @@ private List getFilesToCheck() { // oops, we've got an additional one to process, don't // forget it. No sweat, it's fully resolved via the setter. log("Adding standalone file for audit", Project.MSG_VERBOSE); - allFiles.add(new File(fileName)); + allFiles.add(Path.of(fileName).toFile()); } final List filesFromFileSets = scanFileSets(); allFiles.addAll(filesFromFileSets); - final List filesFromPaths = scanPaths(); - allFiles.addAll(filesFromPaths); + final List filesFromPaths = scanPaths(); + allFiles.addAll(filesFromPaths.stream() + .map(Path::toFile) + .collect(Collectors.toUnmodifiableList())); return allFiles; } @@ -505,12 +508,12 @@ private List getFilesToCheck() { * * @return a list of files defined via paths. */ - private List scanPaths() { - final List allFiles = new ArrayList<>(); + private List scanPaths() { + final List allFiles = new ArrayList<>(); for (int i = 0; i < paths.size(); i++) { - final Path currentPath = paths.get(i); - final List pathFiles = scanPath(currentPath, i + 1); + final org.apache.tools.ant.types.Path currentPath = paths.get(i); + final List pathFiles = scanPath(currentPath, i + 1); allFiles.addAll(pathFiles); } @@ -524,23 +527,23 @@ private List scanPaths() { * @param pathIndex The index of the given path. Used in log messages only. * @return A list of files, extracted from the given path. */ - private List scanPath(Path path, int pathIndex) { + private List scanPath(org.apache.tools.ant.types.Path path, int pathIndex) { final String[] resources = path.list(); log(pathIndex + ") Scanning path " + path, Project.MSG_VERBOSE); - final List allFiles = new ArrayList<>(); + final List allFiles = new ArrayList<>(); int concreteFilesCount = 0; for (String resource : resources) { - final File file = new File(resource); - if (file.isFile()) { + final Path file = Path.of(resource); + if (Files.isRegularFile(file)) { concreteFilesCount++; allFiles.add(file); } else { final DirectoryScanner scanner = new DirectoryScanner(); - scanner.setBasedir(file); + scanner.setBasedir(file.toFile()); scanner.scan(); - final List scannedFiles = retrieveAllScannedFiles(scanner, pathIndex); + final List scannedFiles = retrieveAllScannedFiles(scanner, pathIndex); allFiles.addAll(scannedFiles); } } @@ -559,16 +562,18 @@ private List scanPath(Path path, int pathIndex) { * @return the list of files included via the filesets. */ protected List scanFileSets() { - final List allFiles = new ArrayList<>(); + final List allFiles = new ArrayList<>(); for (int i = 0; i < fileSets.size(); i++) { final FileSet fileSet = fileSets.get(i); final DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject()); - final List scannedFiles = retrieveAllScannedFiles(scanner, i); + final List scannedFiles = retrieveAllScannedFiles(scanner, i); allFiles.addAll(scannedFiles); } - return allFiles; + return allFiles.stream() + .map(Path::toFile) + .collect(Collectors.toUnmodifiableList()); } /** @@ -579,15 +584,14 @@ protected List scanFileSets() { * @param logIndex A log entry index. Used only for log messages. * @return A list of files, retrieved from the given scanner. */ - private List retrieveAllScannedFiles(DirectoryScanner scanner, int logIndex) { + private List retrieveAllScannedFiles(FileScanner scanner, int logIndex) { final String[] fileNames = scanner.getIncludedFiles(); log(String.format(Locale.ROOT, "%d) Adding %d files from directory %s", - logIndex, fileNames.length, scanner.getBasedir()), Project.MSG_VERBOSE); + logIndex, fileNames.length, scanner.getBasedir()), Project.MSG_VERBOSE); return Arrays.stream(fileNames) - .map(name -> scanner.getBasedir() + File.separator + name) - .map(File::new) - .collect(Collectors.toUnmodifiableList()); + .map(scanner.getBasedir().toPath()::resolve) + .collect(Collectors.toUnmodifiableList()); } /** 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 c629d7d472e..2c4dc6b931b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java @@ -1354,7 +1354,54 @@ public final class JavadocTokenTypes { */ public static final int TH_HTML_TAG_NAME = JavadocParser.TH_HTML_TAG_NAME; - /** Body tag name. */ + /** + * Body tag name. + * + *

    Example:

    + *
    {@code
    +     *  <body>
    +     *     <p>Body Content</p>
    +     *  </body>
    +     *  }
    + * Tree: + *
    +     *  {@code
    +     *  HTML_ELEMENT -> HTML_ELEMENT
    +     *   `--BODY -> BODY
    +     *       |--BODY_TAG_START -> BODY_TAG_START
    +     *       |   |--START -> <
    +     *       |   |--BODY_HTML_TAG_NAME -> body
    +     *       |   `--END -> >
    +     *       |--NEWLINE -> \r\n
    +     *       |--LEADING_ASTERISK ->  *
    +     *       |--TEXT ->
    +     *       |--PARAGRAPH -> PARAGRAPH
    +     *       |   |--P_TAG_START -> P_TAG_START
    +     *       |   |   |--START -> <
    +     *       |   |   |--P_HTML_TAG_NAME -> p
    +     *       |   |   `--END -> >
    +     *       |   |--TEXT -> Body Content
    +     *       |   `--P_TAG_END -> P_TAG_END
    +     *       |       |--START -> <
    +     *       |       |--SLASH -> /
    +     *       |       |--P_HTML_TAG_NAME -> p
    +     *       |       `--END -> >
    +     *       |--NEWLINE -> \r\n
    +     *       |--LEADING_ASTERISK ->  *
    +     *       |--TEXT ->
    +     *       `--BODY_TAG_END -> BODY_TAG_END
    +     *           |--START -> <
    +     *           |--SLASH -> /
    +     *           |--BODY_HTML_TAG_NAME -> body
    +     *           `--END -> >
    +     *  }
    +     *  
    + * + * @see + * + * comments are written in HTML + * @see #BODY_HTML_TAG_NAME + */ public static final int BODY_HTML_TAG_NAME = JavadocParser.BODY_HTML_TAG_NAME; /** @@ -1507,7 +1554,63 @@ public final class JavadocTokenTypes { */ public static final int DT_HTML_TAG_NAME = JavadocParser.DT_HTML_TAG_NAME; - /** Head tag name. */ + /** + * Head tag name. + * + *

    Example:

    + *
    {@code
    +     * <head>
    +     *   <title>Page Title</title>
    +     *   <meta charset="UTF-8">
    +     * </head>
    +     * }
    + * Tree: + *
    {@code
    +     *  HEAD -> HEAD
    +     *   |--HEAD_TAG_START -> HEAD_TAG_START
    +     *   |   |--START -> <
    +     *   |   |--HEAD_HTML_TAG_NAME -> head
    +     *   |   `--END -> >
    +     *   |--NEWLINE -> \r\n
    +     *   |--LEADING_ASTERISK ->  *
    +     *   |--TEXT ->
    +     *   |--HTML_TAG -> HTML_TAG
    +     *   |   |--HTML_ELEMENT_START -> HTML_ELEMENT_START
    +     *   |   |   |--START -> <
    +     *   |   |   |--HTML_TAG_NAME -> title
    +     *   |   |   `--END -> >
    +     *   |   |--TEXT -> Page Title
    +     *   |   `--HTML_ELEMENT_END -> HTML_ELEMENT_END
    +     *   |       |--START -> <
    +     *   |       |--SLASH -> /
    +     *   |       |--HTML_TAG_NAME -> title
    +     *   |       `--END -> >
    +     *   |--NEWLINE -> \r\n
    +     *   |--LEADING_ASTERISK ->  *
    +     *   |--TEXT ->
    +     *   |--SINGLETON_ELEMENT -> SINGLETON_ELEMENT
    +     *   |   `--META_TAG -> META_TAG
    +     *   |       |--START -> <
    +     *   |       |--META_HTML_TAG_NAME -> meta
    +     *   |       |--WS ->
    +     *   |       |--ATTRIBUTE -> ATTRIBUTE
    +     *   |       |   |--HTML_TAG_NAME -> charset
    +     *   |       |   |--EQUALS -> =
    +     *   |       |   `--ATTR_VALUE -> "UTF-8"
    +     *   |       `--END -> >
    +     *   |--NEWLINE -> \r\n
    +     *   |--LEADING_ASTERISK ->  *
    +     *   |--TEXT ->
    +     *   `--HEAD_TAG_END -> HEAD_TAG_END
    +     *       |--START -> <
    +     *       |--SLASH -> /
    +     *       |--HEAD_HTML_TAG_NAME -> head
    +     *       `--END -> >
    +     * }
    +     * 
    + * + * @see #HEAD_HTML_TAG_NAME + */ public static final int HEAD_HTML_TAG_NAME = JavadocParser.HEAD_HTML_TAG_NAME; /** Html tag name. */ @@ -2282,14 +2385,14 @@ public final class JavadocTokenTypes { * | |--SLASH -> / * | |--BODY_HTML_TAG_NAME -> body * | `--END -> > - * |--NEWLINE -> \n - * |--LEADING_ASTERISK -> * - * |--TEXT -> / - * |--NEWLINE -> \n - * |--TEXT -> public class Test { - * |--NEWLINE -> \n - * |--TEXT -> } - * |--NEWLINE -> \n + * |--NEWLINE -> \n + * |--LEADING_ASTERISK -> * + * |--TEXT -> / + * |--NEWLINE -> \n + * |--TEXT -> public class Test { + * |--NEWLINE -> \n + * |--TEXT -> } + * |--NEWLINE -> \n * } * */ @@ -2442,7 +2545,28 @@ public final class JavadocTokenTypes { /** End description of a term tag. */ public static final int DD_TAG_END = JavadocParser.RULE_ddTagEnd + RULE_TYPES_OFFSET; - /** Description term html tag: {@code
    }. */ + /** + * DT html tag. + * + *

    Example AST:

    + *
    {@code 
    Description Term
    }
    + *
    +     * {@code
    +     *   --HTML_ELEMENT -> HTML_ELEMENT
    +     *      `--DT -> DT
    +     *          |--DT_TAG_START -> DT_TAG_START
    +     *          |   |--START -> <
    +     *          |   |--DT_HTML_TAG_NAME -> dt
    +     *          |   `--END -> >
    +     *          |--TEXT -> "Description term"
    +     *          `--DT_TAG_END -> DT_TAG_END
    +     *              |--START -> <
    +     *              |--SLASH -> /
    +     *              |--DT_HTML_TAG_NAME -> dt
    +     *              `--END -> >
    +     * }
    +     * 
    + */ public static final int DT = JavadocParser.RULE_dt + RULE_TYPES_OFFSET; /** Start description term tag. */ public static final int DT_TAG_START = JavadocParser.RULE_dtTagStart + RULE_TYPES_OFFSET; @@ -2625,7 +2749,34 @@ public final class JavadocTokenTypes { /** Basefont html tag. */ public static final int BASEFONT_TAG = JavadocParser.RULE_basefontTag + RULE_TYPES_OFFSET; - /** Br html tag. */ + /** + * Br html tag. + * + *

    Example:

    + *
    {@code 
    line breaks
    }
    + * Tree: + *
    +     * {@code
    +     * JAVADOC -> JAVADOC
    +     * |--NEWLINE -> \r\n
    +     * |--LEADING_ASTERISK ->  *
    +     * |--TEXT ->
    +     * |--HTML_ELEMENT -> HTML_ELEMENT
    +     * |   `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT
    +     * |       `--BR_TAG -> BR_TAG
    +     * |           |--START -> <
    +     * |           |--BR_HTML_TAG_NAME -> br
    +     * |           `--END -> >
    +     * |--TEXT ->  line breaks
    +     * |--HTML_ELEMENT -> HTML_ELEMENT
    +     * |   `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT
    +     * |       `--BR_TAG -> BR_TAG
    +     * |           |--START -> <
    +     * |           |--BR_HTML_TAG_NAME -> br
    +     * |           `--SLASH_END -> />
    +     * }
    +     * 
    + */ public static final int BR_TAG = JavadocParser.RULE_brTag + RULE_TYPES_OFFSET; /** Col html tag. */ @@ -2743,7 +2894,50 @@ public final class JavadocTokenTypes { */ public static final int INPUT_TAG = JavadocParser.RULE_inputTag + RULE_TYPES_OFFSET; - /** Isindex html tag. */ + /** + * Isindex tag name. + * + *

    Example:

    + *
    {@code
    +     * <head>
    +     *    <isindex prompt="search">
    +     * </head>
    +     * }
    + * Tree: + *
    +     * {@code
    +     *   |--HTML_ELEMENT -> HTML_ELEMENT
    +     *   |   `--HEAD -> HEAD
    +     *   |       |--HEAD_TAG_START -> HEAD_TAG_START
    +     *   |       |   |--START -> <
    +     *   |       |   |--HEAD_HTML_TAG_NAME -> head
    +     *   |       |   `--END -> >
    +     *   |       |--NEWLINE -> \r\n
    +     *   |       |--LEADING_ASTERISK ->  *
    +     *   |       |--TEXT ->
    +     *   |       |--SINGLETON_ELEMENT -> SINGLETON_ELEMENT
    +     *   |       |   `--ISINDEX_TAG -> ISINDEX_TAG
    +     *   |       |       |--START -> <
    +     *   |       |       |--ISINDEX_HTML_TAG_NAME -> isindex
    +     *   |       |       |--WS ->
    +     *   |       |       |--ATTRIBUTE -> ATTRIBUTE
    +     *   |       |       |   |--HTML_TAG_NAME -> prompt
    +     *   |       |       |   |--EQUALS -> =
    +     *   |       |       |   `--ATTR_VALUE -> "search"
    +     *   |       |       `--END -> >
    +     *   |       |--NEWLINE -> \r\n
    +     *   |       |--LEADING_ASTERISK ->  *
    +     *   |       |--TEXT ->
    +     *   |       `--HEAD_TAG_END -> HEAD_TAG_END
    +     *   |           |--START -> <
    +     *   |           |--SLASH -> /
    +     *   |           |--HEAD_HTML_TAG_NAME -> head
    +     *   |           `--END -> >
    +     *   |--NEWLINE -> \r\n
    +     *   |--TEXT ->
    +     * }
    +     * 
    + */ public static final int ISINDEX_TAG = JavadocParser.RULE_isindexTag + RULE_TYPES_OFFSET; /** Link html tag. */ @@ -2783,9 +2977,37 @@ public final class JavadocTokenTypes { public static final int PARAM_TAG = JavadocParser.RULE_paramTag + RULE_TYPES_OFFSET; /** - * HTML void element {@code }. + * HTML void element. * - * @see #SINGLETON_ELEMENT + *

    Example:

    + *
    {@code
    +     * 
    +     * }
    + * Tree: + *
    +     * {@code
    +     *    |--HTML_ELEMENT -> HTML_ELEMENT
    +     *    |   `--SINGLETON_ELEMENT -> SINGLETON_ELEMENT
    +     *    |       `--EMBED_TAG -> EMBED_TAG
    +     *    |           |--START -> <
    +     *    |           |--EMBED_HTML_TAG_NAME -> embed
    +     *    |           |--WS ->
    +     *    |           |--ATTRIBUTE -> ATTRIBUTE
    +     *    |           |   |--HTML_TAG_NAME -> src
    +     *    |           |   |--EQUALS -> =
    +     *    |           |   `--ATTR_VALUE -> "URL"
    +     *    |           |--WS ->
    +     *    |           |--ATTRIBUTE -> ATTRIBUTE
    +     *    |           |   |--HTML_TAG_NAME -> type
    +     *    |           |   |--EQUALS -> =
    +     *    |           |   `--ATTR_VALUE -> "MIME_type"
    +     *    |           `--END -> >
    +     *    |--NEWLINE -> \r\n
    +     *    |--TEXT ->
    +     * }
    +     * 
    + * + * @see #EMBED_TAG * @see * W3 docs */ 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 5d3803127c9..78b202516e8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java @@ -19,8 +19,6 @@ package com.puppycrawl.tools.checkstyle.api; -import java.util.concurrent.atomic.AtomicInteger; - /** * An audit listener that counts how many {@link AuditEvent AuditEvents} * of a given severity have been generated. @@ -32,7 +30,7 @@ public final class SeverityLevelCounter implements AuditListener { private final SeverityLevel level; /** Keeps track of the number of counted events. */ - private final AtomicInteger count = new AtomicInteger(); + private int count; /** * Creates a new counter. @@ -50,20 +48,20 @@ public SeverityLevelCounter(SeverityLevel level) { @Override public void addError(AuditEvent event) { if (level == event.getSeverityLevel()) { - count.incrementAndGet(); + count++; } } @Override public void addException(AuditEvent event, Throwable throwable) { if (level == SeverityLevel.ERROR) { - count.incrementAndGet(); + count++; } } @Override public void auditStarted(AuditEvent event) { - count.set(0); + count = 0; } @Override @@ -87,7 +85,7 @@ public void fileFinished(AuditEvent event) { * @return the number of counted events since audit started. */ public int getCount() { - return count.get(); + return count; } } 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 6dde5f85950..30a7e22b334 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java @@ -28,11 +28,14 @@ import java.util.Optional; import java.util.regex.Pattern; +import javax.annotation.Nullable; + import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtil; /** *
    @@ -122,6 +125,30 @@ public static String getDefaultAlias(String sourceName) { return sourceNameLower.substring(startIndex, endIndex); } + /** + * Returns the alias of simple check name for a check, The alias is + * for the form of CheckNameCheck or CheckName. + * + * @param sourceName the source name of the check (generally the class + * name) + * @return the alias of the simple check name for the given check + */ + @Nullable + private static String getSimpleNameAlias(String sourceName) { + final String checkName = CommonUtil.baseClassName(sourceName); + final String checkNameSuffix = "Check"; + // check alias for the CheckNameCheck + String checkAlias = CHECK_ALIAS_MAP.get(checkName); + if (checkAlias == null && checkName.endsWith(checkNameSuffix)) { + final int checkStartIndex = checkName.length() - checkNameSuffix.length(); + final String checkNameWithoutSuffix = checkName.substring(0, checkStartIndex); + // check alias for the CheckName + checkAlias = CHECK_ALIAS_MAP.get(checkNameWithoutSuffix); + } + + return checkAlias; + } + /** * Returns the alias for the source name of a check. If an alias has been * explicitly registered via {@link #setAliasList(String...)}, that @@ -133,6 +160,9 @@ public static String getDefaultAlias(String sourceName) { */ public static String getAlias(String sourceName) { String checkAlias = CHECK_ALIAS_MAP.get(sourceName); + if (checkAlias == null) { + checkAlias = getSimpleNameAlias(sourceName); + } if (checkAlias == null) { checkAlias = getDefaultAlias(sourceName); } 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 7bb3cb39702..6539d8ed684 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java @@ -35,7 +35,6 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; -import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -195,7 +194,7 @@ public class TranslationCheck extends AbstractFileSetCheck { private final Log log; /** The files to process. */ - private final Set filesToProcess = ConcurrentHashMap.newKeySet(); + private final Set filesToProcess = new HashSet<>(); /** * Specify 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 f31ec57e559..cec483a5254 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -106,12 +105,12 @@ protected void processFiltered(File file, FileText fileText) { ex.getLocalizedMessage()); } - for (Entry duplication : properties + for (Entry duplication : properties .getDuplicatedKeys().entrySet()) { final String keyName = duplication.getKey(); final int lineNumber = getLineNumber(fileText, keyName); // Number of occurrences is number of duplications + 1 - log(lineNumber, MSG_KEY, keyName, duplication.getValue().get() + 1); + log(lineNumber, MSG_KEY, keyName, duplication.getValue() + 1); } } @@ -174,7 +173,7 @@ private static final class UniqueProperties extends Properties { * Map, holding duplicated keys and their count. Keys are added here only if they * already exist in Properties' inner map. */ - private final Map duplicatedKeys = new HashMap<>(); + private final Map duplicatedKeys = new HashMap<>(); /** * Puts the value into properties by the key specified. @@ -185,8 +184,8 @@ public synchronized Object put(Object key, Object value) { if (oldValue != null && key instanceof String) { final String keyString = (String) key; - duplicatedKeys.computeIfAbsent(keyString, empty -> new AtomicInteger(0)) - .incrementAndGet(); + duplicatedKeys.put(keyString, + duplicatedKeys.getOrDefault(keyString, 0) + 1); } return oldValue; } @@ -196,7 +195,7 @@ public synchronized Object put(Object key, Object value) { * * @return A collection of duplicated keys. */ - public Map getDuplicatedKeys() { + public Map getDuplicatedKeys() { return new HashMap<>(duplicatedKeys); } 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 39170cfe30c..e00254c925e 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 @@ -37,7 +37,8 @@ /** *
    * Checks the distance between declaration of variable and its first usage. - * Note : Variable declaration/initialization statements are not counted while calculating length. + * Note: Any additional variables declared or initialized between the declaration and + * the first usage of the said variable are not counted when calculating the distance. *
    *
      *
    • @@ -331,14 +332,9 @@ else if (currentAst.getType() != TokenTypes.VARIABLE_DEF) { */ private static int getDistToVariableUsageInChildNode(DetailAST childNode, int currentDistToVarUsage) { - DetailAST examineNode = childNode; - if (examineNode.getType() == TokenTypes.LABELED_STAT) { - examineNode = examineNode.getFirstChild().getNextSibling(); - } - int resultDist = currentDistToVarUsage; - switch (examineNode.getType()) { + switch (childNode.getType()) { case TokenTypes.SLIST: resultDist = 0; break; @@ -346,7 +342,6 @@ private static int getDistToVariableUsageInChildNode(DetailAST childNode, case TokenTypes.LITERAL_WHILE: case TokenTypes.LITERAL_DO: case TokenTypes.LITERAL_IF: - case TokenTypes.LITERAL_SWITCH: // variable usage is in inner scope, treated as 1 block // or in operator expression, then distance + 1 resultDist++; 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 d40de88082e..55d2dd4e73c 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 @@ -157,14 +157,23 @@ private void checkLeftCurly() { protected IndentLevel curlyIndent() { final DetailAST lcurly = getLeftCurly(); IndentLevel expIndentLevel = new IndentLevel(getIndent(), getBraceAdjustment()); - if (!isOnStartOfLine(lcurly) - || lcurly.getParent().getType() == TokenTypes.INSTANCE_INIT) { + if (!isOnStartOfLine(lcurly) || checkIfCodeBlock()) { expIndentLevel = new IndentLevel(getIndent(), 0); } - return expIndentLevel; } + /** + * Checks if lcurly is a Code block. + * + * @return true if lcurly is a code block + */ + private boolean checkIfCodeBlock() { + return getMainAst().getType() == TokenTypes.SLIST + && getParent() instanceof BlockParentHandler + && getParent().getParent() instanceof BlockParentHandler; + } + /** * Determines if child elements within the expression may be nested. * 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 7c09514d5ac..ca471e549d6 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 @@ -308,7 +308,7 @@ public class JavadocMethodCheck extends AbstractCheck { * Setter to control whether to allow inline return tags. * * @param value a {@code boolean} value - * @since 10.22.1 + * @since 10.23.0 */ public void setAllowInlineReturn(boolean value) { allowInlineReturn = value; 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 3ca99f5a1c8..d875b5b427c 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 @@ -19,7 +19,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; -import java.util.Objects; +import java.util.Arrays; import java.util.Optional; import com.puppycrawl.tools.checkstyle.api.DetailNode; @@ -180,7 +180,7 @@ public String toString() { + ", text='" + text + '\'' + ", lineNumber=" + lineNumber + ", columnNumber=" + columnNumber - + ", children=" + Objects.hashCode(children) + + ", children=" + Arrays.hashCode(children) + ", parent=" + parent + ']'; } 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 4b3ee07847b..0b41453d088 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 @@ -23,8 +23,8 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.HashSet; import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; import com.puppycrawl.tools.checkstyle.GlobalStatefulCheck; import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; @@ -88,7 +88,7 @@ public class JavadocPackageCheck extends AbstractFileSetCheck { public static final String MSG_PACKAGE_INFO = "javadoc.packageInfo"; /** The directories checked. */ - private final Set directoriesChecked = ConcurrentHashMap.newKeySet(); + private final Set directoriesChecked = new HashSet<>(); /** Allow legacy {@code package.html} file to be used. */ private boolean allowLegacy; 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 2bcef101cdc..3f2c697f9e4 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 @@ -247,10 +247,10 @@ else if (newLine == null || tag.getLineNumber() - newLine.getLineNumber() != 1) */ private static boolean isNestedParagraph(DetailNode tag) { boolean nested = false; - DetailNode parent = tag; + DetailNode parent = tag.getParent(); while (parent != null) { - if (parent.getType() == JavadocTokenTypes.PARAGRAPH) { + if (parent.getType() == JavadocTokenTypes.HTML_ELEMENT) { nested = true; break; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java index a99480f2606..d0e4b5f4447 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java @@ -22,7 +22,6 @@ import java.math.BigInteger; import java.util.ArrayDeque; import java.util.Deque; -import java.util.concurrent.atomic.AtomicInteger; import com.puppycrawl.tools.checkstyle.FileStatefulCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; @@ -548,17 +547,17 @@ private static int countCaseTokens(DetailAST ast) { * @return number of case constant tokens. */ private static int countCaseConstants(DetailAST ast) { - final AtomicInteger counter = new AtomicInteger(); + int counter = 0; final DetailAST literalCase = ast.getFirstChild(); for (DetailAST node = literalCase.getFirstChild(); node != null; node = node.getNextSibling()) { if (TokenUtil.isOfType(node, CASE_LABEL_TOKENS)) { - counter.getAndIncrement(); + counter++; } } - return counter.get(); + return counter; } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheck.java index 23955343684..738850116b3 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheck.java @@ -20,7 +20,6 @@ package com.puppycrawl.tools.checkstyle.checks.sizes; import java.util.Arrays; -import java.util.concurrent.atomic.AtomicInteger; import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; @@ -28,7 +27,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption; import com.puppycrawl.tools.checkstyle.utils.CheckUtil; -import com.puppycrawl.tools.checkstyle.utils.TokenUtil; /** *
      @@ -156,11 +154,7 @@ public void visitToken(DetailAST ast) { * @return the number of record components in this record definition */ private static int countComponents(DetailAST recordComponents) { - final AtomicInteger count = new AtomicInteger(0); - TokenUtil.forEachChild(recordComponents, - TokenTypes.RECORD_COMPONENT_DEF, - node -> count.getAndIncrement()); - return count.get(); + return recordComponents.getChildCount(TokenTypes.RECORD_COMPONENT_DEF); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java index 3fb2a611994..165cfd665d6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java @@ -27,7 +27,6 @@ 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.FileContents; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.utils.CheckUtil; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; @@ -661,15 +660,12 @@ private static Optional findCommentUnder(DetailAST packageDef) { * @return {@code true} if found any blank line within the range, {@code false} * otherwise */ - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 - @SuppressWarnings("deprecation") private boolean hasEmptyLine(int startLine, int endLine) { // Initial value is false - blank line not found boolean result = false; - final FileContents fileContents = getFileContents(); for (int line = startLine; line <= endLine; line++) { // Check, if the line is blank. Lines are numbered from 0, so subtract 1 - if (fileContents.lineIsBlank(line - 1)) { + if (CommonUtil.isBlank(getLine(line - 1))) { result = true; break; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java index 6375e44762e..efddb8a951d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java @@ -76,7 +76,7 @@ public class SuppressFilterElement * @param columns columns CSV values and ranges for column number filtering. */ public SuppressFilterElement(String files, String checks, - String message, String modId, String lines, String columns) { + String message, String modId, String lines, String columns) { if (files == null) { fileRegexp = null; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java b/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java index a7c5e0d9b32..04742a7bb7a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java @@ -105,19 +105,21 @@ else if (tagName.equals(PARAM.toString()) && !isSecondParsing()) { @Override protected void handleEndTag(XmlPullParser parser, Sink sink) throws MacroExecutionException { final String tagName = parser.getName(); - if (tagName.equals(DOCUMENT_TAG.toString())) { - sink.rawText(parser.getText()); - sink.body_(); - } - else if (macroName != null - && tagName.equals(MACRO_TAG.toString()) - && !macroName.isEmpty() - && !isSecondParsing()) { - processMacroEnd(sink); - setIgnorableWhitespace(false); - } - else if (!tagName.equals(PARAM.toString())) { - sink.rawText(parser.getText()); + if (!"hr".equalsIgnoreCase(tagName)) { + if (tagName.equals(DOCUMENT_TAG.toString())) { + sink.rawText(parser.getText()); + sink.body_(); + } + else if (macroName != null + && tagName.equals(MACRO_TAG.toString()) + && !macroName.isEmpty() + && !isSecondParsing()) { + processMacroEnd(sink); + setIgnorableWhitespace(false); + } + else if (!tagName.equals(PARAM.toString())) { + sink.rawText(parser.getText()); + } } } diff --git a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/coding/VariableDeclarationUsageDistanceCheck.xml b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/coding/VariableDeclarationUsageDistanceCheck.xml index 59e578cc9bf..748bf8d0105 100644 --- a/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/coding/VariableDeclarationUsageDistanceCheck.xml +++ b/src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/coding/VariableDeclarationUsageDistanceCheck.xml @@ -6,7 +6,8 @@ parent="com.puppycrawl.tools.checkstyle.TreeWalker"> <div> Checks the distance between declaration of variable and its first usage. - Note : Variable declaration/initialization statements are not counted while calculating length. + Note: Any additional variables declared or initialized between the declaration and + the first usage of the said variable are not counted when calculating the distance. </div> diff --git a/src/main/resources/google_checks.xml b/src/main/resources/google_checks.xml index 7a48dbeb279..5906505ca2c 100644 --- a/src/main/resources/google_checks.xml +++ b/src/main/resources/google_checks.xml @@ -105,22 +105,32 @@ + + + + + COMPACT_CTOR_DEF, LITERAL_SWITCH, LITERAL_CASE, LITERAL_FINALLY, + LITERAL_CATCH"/> - + - + //*[self::RCURLY][parent::SLIST[count(./*)=1]] + | //SLIST[count(./*)=1][parent::LITERAL_TRY and + not(following-sibling::*)] + | //SLIST[count(./*)=1][parent::LITERAL_CATCH and + not(parent::LITERAL_CATCH/following-sibling::*)]"/> @@ -291,13 +305,7 @@ - - - - - + diff --git a/src/site/resources/css/site.css b/src/site/resources/css/site.css index 3f394be2679..d0362be9a2e 100644 --- a/src/site/resources/css/site.css +++ b/src/site/resources/css/site.css @@ -48,7 +48,6 @@ section p { position: relative; top: 0; left: 40px; - } #bannerLeft h1 { @@ -232,12 +231,7 @@ pre { margin: 3px 0; } -#bodyColumn { - margin-left: 286px; -} - #leftColumn { - min-width: 250px; overflow-wrap: break-word; word-wrap: break-word; } @@ -326,7 +320,26 @@ span.wrapper.inline { transition: transform 0.3s ease, opacity 0.3s ease; } +.example-separator { + border: none; + height: 3px; + width: 100%; + margin: 40px 0; + background: linear-gradient( + to right, + rgba(51, 51, 51, 0) 0%, + rgba(51, 51, 51, 1) 10%, + rgba(51, 51, 51, 1) 90%, + rgba(51, 51, 51, 0) 100% + ); +} + @media screen and (max-width: 823px) { + body { + padding-left: 0; + padding-right: 0; + } + #leftColumn { float: none; width: auto; @@ -354,11 +367,6 @@ span.wrapper.inline { box-shadow: 0 5px 10px -3px rgba(0,0,0,0.5); } - .container-fluid { - padding-left: 0; - padding-right: 0; - } - #bodyColumn { margin: 0.5em; } diff --git a/src/site/resources/images/header-right-ruller.png b/src/site/resources/images/header-right-ruler.png similarity index 100% rename from src/site/resources/images/header-right-ruller.png rename to src/site/resources/images/header-right-ruler.png diff --git a/src/site/resources/js/checkstyle.js b/src/site/resources/js/checkstyle.js index 0a084f25d05..b3ce3f6aa60 100644 --- a/src/site/resources/js/checkstyle.js +++ b/src/site/resources/js/checkstyle.js @@ -51,9 +51,6 @@ window.addEventListener("load", function () { // for newer version of site. window.addEventListener("load", function () { - const bodyColumn = document.getElementById("bodyColumn"); - bodyColumn.classList.remove("span10"); - const externalLinks = document.querySelectorAll(".externalLink"); externalLinks.forEach((link) => { link.setAttribute("target", "_blank"); @@ -71,8 +68,21 @@ window.addEventListener("scroll", function () { }); function setBodyColumnMargin() { - const leftColumn = document.querySelector("#leftColumn"); - const bodyColumn = document.querySelector("#bodyColumn"); + const leftColumn = document.getElementById("leftColumn"); + const bodyColumn = document.getElementById("bodyColumn"); + + if (window.innerWidth > 1920) { + leftColumn.className = "span2"; + bodyColumn.className = "span10"; + } else if (window.innerWidth > 1280) { + leftColumn.className = "span3"; + bodyColumn.className = "span9"; + } else if (window.innerWidth > 823) { + leftColumn.className = "span4"; + bodyColumn.className = "span8"; + } else { + bodyColumn.className = "span12"; + } if (window.innerWidth > 823 && document.querySelector("#hamburger")) { resetStyling(); @@ -151,7 +161,7 @@ function trimCodeBlock(codeBlock) { while ((node = walker.nextNode())) { textNodes.push(node); } - + for (let i = 0; i < textNodes.length; i++) { const txt = textNodes[i].textContent; const trimmed = txt.trim(); diff --git a/src/site/site.xml b/src/site/site.xml index 86584fbc4cb..6509103f3f5 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -10,11 +10,19 @@ maven-fluido-skin 2.0.1 + + + + span4 + span8 + + + Checkstyle - Checkstyle + diff --git a/src/site/xdoc/checks/annotation/annotationlocation.xml b/src/site/xdoc/checks/annotation/annotationlocation.xml index 0583812e985..f37ed4c9c5f 100644 --- a/src/site/xdoc/checks/annotation/annotationlocation.xml +++ b/src/site/xdoc/checks/annotation/annotationlocation.xml @@ -165,7 +165,7 @@ class Example1 { @Nonnull @Mock DataLoader loader3; // violation above, 'Annotation 'Mock' should be alone on line' } -
      +

    Use the following configuration to allow multiple annotations on the same line:

    @@ -198,7 +198,7 @@ class Example2 { @Nonnull @Mock DataLoader loader2; // ok above as 'allowSamelineMultipleAnnotations' set to true } - +

    Use the following configuration to allow only one and only parameterized annotation on the same line: @@ -234,7 +234,7 @@ class Example3 { @Nonnull @Mock DataLoader loader2; // violation above, 'Annotation 'Mock' should be alone on line.' } - +


    Use the following configuration to only validate annotations on methods to allow one single parameterless annotation on the same line: diff --git a/src/site/xdoc/checks/annotation/annotationlocation.xml.template b/src/site/xdoc/checks/annotation/annotationlocation.xml.template index bb5036f6e27..9dff8f96667 100644 --- a/src/site/xdoc/checks/annotation/annotationlocation.xml.template +++ b/src/site/xdoc/checks/annotation/annotationlocation.xml.template @@ -69,7 +69,7 @@ public String getNameIfPresent() { ... } - +


    Use the following configuration to allow multiple annotations on the same line:

    @@ -83,7 +83,7 @@ public String getNameIfPresent() { ... } - +

    Use the following configuration to allow only one and only parameterized annotation on the same line: @@ -98,7 +98,7 @@ public String getNameIfPresent() { ... } - +


    Use the following configuration to only validate annotations on methods to allow one single parameterless annotation on the same line: diff --git a/src/site/xdoc/checks/annotation/annotationonsameline.xml b/src/site/xdoc/checks/annotation/annotationonsameline.xml index 4a9461cc0f4..5654a9dd340 100644 --- a/src/site/xdoc/checks/annotation/annotationonsameline.xml +++ b/src/site/xdoc/checks/annotation/annotationonsameline.xml @@ -138,8 +138,7 @@ class Example1 { } } - - +


    To configure the check to check for annotations applied on interfaces, variables and constructors: diff --git a/src/site/xdoc/checks/annotation/annotationonsameline.xml.template b/src/site/xdoc/checks/annotation/annotationonsameline.xml.template index c28e835b26a..88d8680956e 100644 --- a/src/site/xdoc/checks/annotation/annotationonsameline.xml.template +++ b/src/site/xdoc/checks/annotation/annotationonsameline.xml.template @@ -39,8 +39,7 @@ - - +


    To configure the check to check for annotations applied on interfaces, variables and constructors: diff --git a/src/site/xdoc/checks/annotation/annotationusestyle.xml b/src/site/xdoc/checks/annotation/annotationusestyle.xml index 0245288aee7..3a6cf980de1 100644 --- a/src/site/xdoc/checks/annotation/annotationusestyle.xml +++ b/src/site/xdoc/checks/annotation/annotationusestyle.xml @@ -150,8 +150,7 @@ class TestStyle1 { } - - +


    To configure the check to enforce an expanded style, with a closing parenthesis and a trailing array comma set to never. @@ -185,8 +184,7 @@ public class Example2 class TestStyle2 { } - - +


    To configure the check to enforce an expanded style, with a closing parenthesis and a trailing array comma set to never. @@ -220,8 +218,7 @@ public class Example3 class TestStyle3 { } - - +


    To configure the check to enforce a trailing array comma, with ignoring the elementStyle and a closing parenthesis. diff --git a/src/site/xdoc/checks/annotation/annotationusestyle.xml.template b/src/site/xdoc/checks/annotation/annotationusestyle.xml.template index 0aa2af59267..7893401cea8 100644 --- a/src/site/xdoc/checks/annotation/annotationusestyle.xml.template +++ b/src/site/xdoc/checks/annotation/annotationusestyle.xml.template @@ -108,8 +108,7 @@ - - +


    To configure the check to enforce an expanded style, with a closing parenthesis and a trailing array comma set to never. @@ -124,8 +123,7 @@ - - +


    To configure the check to enforce an expanded style, with a closing parenthesis and a trailing array comma set to never. @@ -140,8 +138,7 @@ - - +


    To configure the check to enforce a trailing array comma, with ignoring the elementStyle and a closing parenthesis. diff --git a/src/site/xdoc/checks/annotation/missingdeprecated.xml b/src/site/xdoc/checks/annotation/missingdeprecated.xml index e82cc1bd0c8..3d0853741c1 100644 --- a/src/site/xdoc/checks/annotation/missingdeprecated.xml +++ b/src/site/xdoc/checks/annotation/missingdeprecated.xml @@ -106,8 +106,7 @@ class Example1 { @Deprecated public static final int CONST = 12; // ok } - - +


    To configure the check such that it prints violation messages if tight HTML rules are not obeyed diff --git a/src/site/xdoc/checks/annotation/missingdeprecated.xml.template b/src/site/xdoc/checks/annotation/missingdeprecated.xml.template index 31b683d4b8e..c2d2c83fef6 100644 --- a/src/site/xdoc/checks/annotation/missingdeprecated.xml.template +++ b/src/site/xdoc/checks/annotation/missingdeprecated.xml.template @@ -71,8 +71,7 @@ - - +


    To configure the check such that it prints violation messages if tight HTML rules are not obeyed diff --git a/src/site/xdoc/checks/annotation/missingoverride.xml b/src/site/xdoc/checks/annotation/missingoverride.xml index 5b77920ec6d..f02789ad255 100644 --- a/src/site/xdoc/checks/annotation/missingoverride.xml +++ b/src/site/xdoc/checks/annotation/missingoverride.xml @@ -100,7 +100,7 @@ class Example1 extends ParentClass1 { } } - +


    To configure the check for the javaFiveCompatibility mode: diff --git a/src/site/xdoc/checks/annotation/missingoverride.xml.template b/src/site/xdoc/checks/annotation/missingoverride.xml.template index 9394e4cc27a..b8fbf7b3ece 100644 --- a/src/site/xdoc/checks/annotation/missingoverride.xml.template +++ b/src/site/xdoc/checks/annotation/missingoverride.xml.template @@ -64,7 +64,7 @@ - +


    To configure the check for the javaFiveCompatibility mode: diff --git a/src/site/xdoc/checks/annotation/packageannotation.xml b/src/site/xdoc/checks/annotation/packageannotation.xml index f166023bb26..aa00c45da99 100644 --- a/src/site/xdoc/checks/annotation/packageannotation.xml +++ b/src/site/xdoc/checks/annotation/packageannotation.xml @@ -47,13 +47,13 @@ package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation; // violation above, 'Package annotations must be in the package-info.java info.' class Example1 {} - +


    Example of class without violation:

    
     package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation;
     
     class Example2 {}
    -
    +

    Example of validating package-info.java:

    
     @Deprecated
    diff --git a/src/site/xdoc/checks/annotation/packageannotation.xml.template b/src/site/xdoc/checks/annotation/packageannotation.xml.template
    index 0d5943c885d..8aa55e30461 100644
    --- a/src/site/xdoc/checks/annotation/packageannotation.xml.template
    +++ b/src/site/xdoc/checks/annotation/packageannotation.xml.template
    @@ -43,13 +43,13 @@
               
               
    -        
    +        

    Example of class without violation:

    - +

    Example of validating package-info.java:

    - +

    To configure the check so that the "unchecked" and "unused" warnings cannot be suppressed on anything diff --git a/src/site/xdoc/checks/annotation/suppresswarnings.xml.template b/src/site/xdoc/checks/annotation/suppresswarnings.xml.template index b2a00be3792..dc25dcdc8bf 100644 --- a/src/site/xdoc/checks/annotation/suppresswarnings.xml.template +++ b/src/site/xdoc/checks/annotation/suppresswarnings.xml.template @@ -74,8 +74,7 @@ - - +


    To configure the check so that the "unchecked" and "unused" warnings cannot be suppressed on anything diff --git a/src/site/xdoc/checks/annotation/suppresswarningsholder.xml b/src/site/xdoc/checks/annotation/suppresswarningsholder.xml index 6a865fbce81..cdea5e285b2 100644 --- a/src/site/xdoc/checks/annotation/suppresswarningsholder.xml +++ b/src/site/xdoc/checks/annotation/suppresswarningsholder.xml @@ -50,14 +50,13 @@

    
     <module name="Checker">
       <module name="TreeWalker">
    -  <module name="MemberName"/>
    -  <module name="ConstantName"/>
    -  <module name="ParameterNumber">
    -    <property name="id" value="ParamNumberId"/>
    -  </module>
    -  <module name=
    -    "NoWhitespaceAfter"/>
    -  <module name="SuppressWarningsHolder"/>
    +    <module name="MemberName"/>
    +    <module name="ConstantName"/>
    +    <module name="ParameterNumber">
    +      <property name="id" value="ParamNumberId"/>
    +    </module>
    +    <module name="NoWhitespaceAfter"/>
    +    <module name="SuppressWarningsHolder"/>
       </module>
       <module name="SuppressWarningsFilter"/>
     </module>
    @@ -84,24 +83,25 @@ class Example1 {
       @SuppressWarnings("all")
       private int [] ARRAY; // violations suppressed
     }
    -
    +

    The general rule is that the argument of the @SuppressWarnings will be matched against class name of the check in any letter case. Adding check suffix is also accepted.

    If aliasList property was provided you can use your own names e.g. below - code will work if there was provided a ParameterNumberCheck=paramnum in - the aliasList: + code will work if there was provided a + com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck=paramnum + in the aliasList:

    
     <module name="Checker">
       <module name="TreeWalker">
    -  <module name="ParameterNumber"/>
    -  <module name="SuppressWarningsHolder">
    -    <property name="aliasList" value=
    -      "com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck=paramnum"/>
    -  </module>
    +    <module name="ParameterNumber"/>
    +    <module name="SuppressWarningsHolder">
    +      <property name="aliasList"
    +        value="com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck=paramnum"/>
    +    </module>
       </module>
       <module name="SuppressWarningsFilter"/>
     </module>
    @@ -121,6 +121,70 @@ class Example2 {
         // ...
       }
     
    +}
    +
    +

    + You can also use simple check name like ParameterNumberCheck=paramnum + instead to use fully qualified name of check in the aliasList: +

    +
    
    +<module name="Checker">
    +  <module name="TreeWalker">
    +    <module name="ParameterNumber"/>
    +    <module name="SuppressWarningsHolder">
    +      <property name="aliasList" value="ParameterNumberCheck=paramnum"/>
    +    </module>
    +  </module>
    +  <module name="SuppressWarningsFilter"/>
    +</module>
    +
    +

    Example:

    +
    
    +public class Example3 {
    +  // violation below, 'More than 7 parameters (found 8)'
    +  public void needsLotsOfParameters (int a,
    +    int b, int c, int d, int e, int f, int g, int h) {
    +    // ...
    +  }
    +
    +  @SuppressWarnings("paramnum")
    +  public void needsLotsOfParameters1 (int a, // violation suppressed
    +    int b, int c, int d, int e, int f, int g, int h) {
    +    // ...
    +  }
    +
    +}
    +
    +

    + The check can also be used without suffix of "Check" like + ParameterNumber=paramnum in the aliasList: +

    +
    
    +<module name="Checker">
    +  <module name="TreeWalker">
    +    <module name="ParameterNumber"/>
    +    <module name="SuppressWarningsHolder">
    +      <property name="aliasList" value="ParameterNumber=paramnum"/>
    +    </module>
    +  </module>
    +  <module name="SuppressWarningsFilter"/>
    +</module>
    +
    +

    Example:

    +
    
    +public class Example4 {
    +  // violation below, 'More than 7 parameters (found 8)'
    +  public void needsLotsOfParameters (int a,
    +    int b, int c, int d, int e, int f, int g, int h) {
    +    // ...
    +  }
    +
    +  @SuppressWarnings("paramnum")
    +  public void needsLotsOfParameters1 (int a, // violation suppressed
    +    int b, int c, int d, int e, int f, int g, int h) {
    +    // ...
    +  }
    +
     }
     
    diff --git a/src/site/xdoc/checks/annotation/suppresswarningsholder.xml.template b/src/site/xdoc/checks/annotation/suppresswarningsholder.xml.template index 5a6ed01a990..f0b45c9d2bc 100644 --- a/src/site/xdoc/checks/annotation/suppresswarningsholder.xml.template +++ b/src/site/xdoc/checks/annotation/suppresswarningsholder.xml.template @@ -45,15 +45,16 @@ - +

    The general rule is that the argument of the @SuppressWarnings will be matched against class name of the check in any letter case. Adding check suffix is also accepted.

    If aliasList property was provided you can use your own names e.g. below - code will work if there was provided a ParameterNumberCheck=paramnum in - the aliasList: + code will work if there was provided a + com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck=paramnum + in the aliasList:

    +

    + You can also use simple check name like ParameterNumberCheck=paramnum + instead to use fully qualified name of check in the aliasList: +

    + + + + +

    Example:

    + + + + +

    + The check can also be used without suffix of "Check" like + ParameterNumber=paramnum in the aliasList: +

    + + + + +

    Example:

    + + + + diff --git a/src/site/xdoc/checks/blocks/avoidnestedblocks.xml b/src/site/xdoc/checks/blocks/avoidnestedblocks.xml index e251189d958..e7dd0edcaaf 100644 --- a/src/site/xdoc/checks/blocks/avoidnestedblocks.xml +++ b/src/site/xdoc/checks/blocks/avoidnestedblocks.xml @@ -100,7 +100,7 @@ public class Example1 { } } } - +

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

    
     <module name="Checker">
    diff --git a/src/site/xdoc/checks/blocks/avoidnestedblocks.xml.template b/src/site/xdoc/checks/blocks/avoidnestedblocks.xml.template
    index c23c6c5adc2..35822cd7b4a 100644
    --- a/src/site/xdoc/checks/blocks/avoidnestedblocks.xml.template
    +++ b/src/site/xdoc/checks/blocks/avoidnestedblocks.xml.template
    @@ -70,7 +70,7 @@ public void guessTheOutput()
                 
                 
    -        
    +        

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

    +

    To configure the check for the text policy and only try blocks: @@ -157,7 +157,7 @@ public class Example2 { } } } - +


    To configure the check for case and default in switch block:

    diff --git a/src/site/xdoc/checks/blocks/emptyblock.xml.template b/src/site/xdoc/checks/blocks/emptyblock.xml.template index bb071ce648a..4d903c8e70f 100644 --- a/src/site/xdoc/checks/blocks/emptyblock.xml.template +++ b/src/site/xdoc/checks/blocks/emptyblock.xml.template @@ -41,7 +41,7 @@ - +

    To configure the check for the text policy and only try blocks: @@ -56,7 +56,7 @@ - +


    To configure the check for case and default in switch block:

    diff --git a/src/site/xdoc/checks/blocks/emptycatchblock.xml b/src/site/xdoc/checks/blocks/emptycatchblock.xml index 78eb38d2847..8356df7eefc 100644 --- a/src/site/xdoc/checks/blocks/emptycatchblock.xml +++ b/src/site/xdoc/checks/blocks/emptycatchblock.xml @@ -95,8 +95,7 @@ public class Example1 { } } } - - +

    To configure the check to suppress empty catch block if exception's variable name is expected or ignore or there's any comment inside: @@ -143,8 +142,7 @@ public class Example2 { } } } - - +


    To configure the check to suppress empty catch block if single-line comment inside is "This is expected": @@ -191,8 +189,7 @@ public class Example3 { } } } - - +


    To configure the check to suppress empty catch block if single-line comment inside is "This is expected": @@ -254,8 +251,7 @@ public class Example4 { } } } - - +


    To configure the check to suppress empty catch block if exception's variable name is "myException": diff --git a/src/site/xdoc/checks/blocks/emptycatchblock.xml.template b/src/site/xdoc/checks/blocks/emptycatchblock.xml.template index cf18f1a5457..ecb46d62d5b 100644 --- a/src/site/xdoc/checks/blocks/emptycatchblock.xml.template +++ b/src/site/xdoc/checks/blocks/emptycatchblock.xml.template @@ -46,8 +46,7 @@ - - +


    To configure the check to suppress empty catch block if exception's variable name is expected or ignore or there's any comment inside: @@ -62,8 +61,7 @@ - - +


    To configure the check to suppress empty catch block if single-line comment inside is "This is expected": @@ -78,8 +76,7 @@ - - +


    To configure the check to suppress empty catch block if single-line comment inside is "This is expected": @@ -94,8 +91,7 @@ - - +


    To configure the check to suppress empty catch block if exception's variable name is "myException": diff --git a/src/site/xdoc/checks/blocks/leftcurly.xml b/src/site/xdoc/checks/blocks/leftcurly.xml index 99753e843b7..987f4f8371e 100644 --- a/src/site/xdoc/checks/blocks/leftcurly.xml +++ b/src/site/xdoc/checks/blocks/leftcurly.xml @@ -178,7 +178,7 @@ class Example1 GREEN; } } - +


    To configure the check to apply the nl policy to type blocks: @@ -211,7 +211,7 @@ class Example2 GREEN; } } - +


    To configure the check to apply the nlow policy to type blocks: @@ -243,7 +243,7 @@ class Example3 GREEN; } } - +


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

    diff --git a/src/site/xdoc/checks/blocks/leftcurly.xml.template b/src/site/xdoc/checks/blocks/leftcurly.xml.template index 91cdbb54910..a17088bc8d9 100644 --- a/src/site/xdoc/checks/blocks/leftcurly.xml.template +++ b/src/site/xdoc/checks/blocks/leftcurly.xml.template @@ -35,7 +35,7 @@ - +

    To configure the check to apply the nl policy to type blocks: @@ -48,7 +48,7 @@ - +


    To configure the check to apply the nlow policy to type blocks: @@ -61,7 +61,7 @@ - +


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

    diff --git a/src/site/xdoc/checks/blocks/needbraces.xml b/src/site/xdoc/checks/blocks/needbraces.xml index 82bf4f3ec2f..5c7bb97cd68 100644 --- a/src/site/xdoc/checks/blocks/needbraces.xml +++ b/src/site/xdoc/checks/blocks/needbraces.xml @@ -125,7 +125,7 @@ class Example1 { return true; } } - +

    To configure the check for if and else blocks: @@ -177,7 +177,7 @@ class Example2 { return true; } } - +


    To configure the check to allow single-line statements (if, while, do-while, for) without braces: @@ -231,7 +231,7 @@ class Example3 { return true; } } - +


    To configure the check to allow case, default single-line statements without braces: @@ -287,7 +287,7 @@ class Example4 { return true; } } - +


    To configure the check to allow loops (while, for) with empty bodies:

    @@ -339,7 +339,7 @@ class Example5 { return true; } } - +

    To configure the check to lambdas:

    diff --git a/src/site/xdoc/checks/blocks/needbraces.xml.template b/src/site/xdoc/checks/blocks/needbraces.xml.template index 9cabb9a7076..30eccb3f726 100644 --- a/src/site/xdoc/checks/blocks/needbraces.xml.template +++ b/src/site/xdoc/checks/blocks/needbraces.xml.template @@ -34,7 +34,7 @@ - +

    To configure the check for if and else blocks: @@ -49,7 +49,7 @@ - +


    To configure the check to allow single-line statements (if, while, do-while, for) without braces: @@ -64,7 +64,7 @@ - +


    To configure the check to allow case, default single-line statements without braces: @@ -81,7 +81,7 @@ - +


    To configure the check to allow loops (while, for) with empty bodies:

    @@ -95,7 +95,7 @@ - +

    To configure the check to lambdas:

    diff --git a/src/site/xdoc/checks/blocks/rightcurly.xml b/src/site/xdoc/checks/blocks/rightcurly.xml index 15cb151f82e..fa35c7ac8f0 100644 --- a/src/site/xdoc/checks/blocks/rightcurly.xml +++ b/src/site/xdoc/checks/blocks/rightcurly.xml @@ -163,7 +163,7 @@ public class Example1 { public void testSingleLine() { bar(); } // OK, because singleline is allowed } - +

    To configure the check with policy alone for else and @@ -217,7 +217,7 @@ public class Example2 { bar(); } } - +


    To configure the check with policy alone for @@ -263,7 +263,7 @@ class Example3 { // violation above, 'should be alone on a line.' } } - +


    To configure the check with policy alone_or_singleline for if and @@ -314,7 +314,7 @@ public class Example4 { public void violate() { bar(); } // OK , because singleline } - +


    To configure the check with policy alone_or_singleline for diff --git a/src/site/xdoc/checks/blocks/rightcurly.xml.template b/src/site/xdoc/checks/blocks/rightcurly.xml.template index 0d4968e0df5..26195e8fffb 100644 --- a/src/site/xdoc/checks/blocks/rightcurly.xml.template +++ b/src/site/xdoc/checks/blocks/rightcurly.xml.template @@ -43,7 +43,7 @@ - +


    To configure the check with policy alone for else and @@ -60,7 +60,7 @@ - +


    To configure the check with policy alone for @@ -77,7 +77,7 @@ - +


    To configure the check with policy alone_or_singleline for if and @@ -95,7 +95,7 @@ - +


    To configure the check with policy alone_or_singleline for diff --git a/src/site/xdoc/checks/coding/arraytrailingcomma.xml b/src/site/xdoc/checks/coding/arraytrailingcomma.xml index aba45b14c0d..c57315ea962 100644 --- a/src/site/xdoc/checks/coding/arraytrailingcomma.xml +++ b/src/site/xdoc/checks/coding/arraytrailingcomma.xml @@ -149,8 +149,7 @@ public class Example1 { 2 ,}; } - - +


    To configure check to always validate trailing comma:

    
     <module name="Checker">
    diff --git a/src/site/xdoc/checks/coding/arraytrailingcomma.xml.template b/src/site/xdoc/checks/coding/arraytrailingcomma.xml.template
    index cf9aa196832..9d8364e6dbb 100644
    --- a/src/site/xdoc/checks/coding/arraytrailingcomma.xml.template
    +++ b/src/site/xdoc/checks/coding/arraytrailingcomma.xml.template
    @@ -105,8 +105,7 @@ return new int[] {
               
               
    -        
    -
    +        

    To configure check to always validate trailing comma:

    +

    Example of incorrect grouping of constructors:

    
     public class Example2 {
    diff --git a/src/site/xdoc/checks/coding/constructorsdeclarationgrouping.xml.template b/src/site/xdoc/checks/coding/constructorsdeclarationgrouping.xml.template
    index 518d43039c3..a57c12be1cc 100644
    --- a/src/site/xdoc/checks/coding/constructorsdeclarationgrouping.xml.template
    +++ b/src/site/xdoc/checks/coding/constructorsdeclarationgrouping.xml.template
    @@ -38,7 +38,7 @@
               
               
    -        
    +        

    Example of incorrect grouping of constructors:

    
     public class Example1 {
    -  public boolean equals(Example1 same) {  // violation
    +  public boolean equals(Example1 same) {  // violation 'covariant equals'
         return false;
       }
     
       record Test(String str) {
    -    public boolean equals(Test same) {  // violation
    +    public boolean equals(Test same) {  // violation 'covariant equals'
           return false;
         }
       }
     }
    -
    +

    The same class without violations:

    diff --git a/src/site/xdoc/checks/coding/covariantequals.xml.template b/src/site/xdoc/checks/coding/covariantequals.xml.template index 0dc3b6fbedc..3cb1fdc47ea 100644 --- a/src/site/xdoc/checks/coding/covariantequals.xml.template +++ b/src/site/xdoc/checks/coding/covariantequals.xml.template @@ -80,7 +80,7 @@ public boolean equals(Foo obj) {...} - +

    The same class without violations:

    diff --git a/src/site/xdoc/checks/coding/declarationorder.xml b/src/site/xdoc/checks/coding/declarationorder.xml index 57d4d537761..5520c23df75 100644 --- a/src/site/xdoc/checks/coding/declarationorder.xml +++ b/src/site/xdoc/checks/coding/declarationorder.xml @@ -121,7 +121,7 @@ public class Example1 { private String name; // violation, instance variable declaration in wrong order } - +

    To configure the check to ignore validation of constructors:

    @@ -156,7 +156,7 @@ public class Example2 { private String name; // violation, instance variable declaration in wrong order } - +

    To configure the check to ignore modifiers:

    diff --git a/src/site/xdoc/checks/coding/declarationorder.xml.template b/src/site/xdoc/checks/coding/declarationorder.xml.template index 625d4179795..018f972dc8a 100644 --- a/src/site/xdoc/checks/coding/declarationorder.xml.template +++ b/src/site/xdoc/checks/coding/declarationorder.xml.template @@ -83,7 +83,7 @@ public class A { - +

    To configure the check to ignore validation of constructors:

    @@ -97,7 +97,7 @@ public class A { - +

    To configure the check to ignore modifiers:

    diff --git a/src/site/xdoc/checks/coding/defaultcomeslast.xml b/src/site/xdoc/checks/coding/defaultcomeslast.xml index 4480e59bd1d..c5edce12bbc 100644 --- a/src/site/xdoc/checks/coding/defaultcomeslast.xml +++ b/src/site/xdoc/checks/coding/defaultcomeslast.xml @@ -99,7 +99,7 @@ public class Example1 { } } } - +

    To configure the check to allow default label to be not last if it is shared with case:

    diff --git a/src/site/xdoc/checks/coding/defaultcomeslast.xml.template b/src/site/xdoc/checks/coding/defaultcomeslast.xml.template index db8e249a1f4..51de51051e1 100644 --- a/src/site/xdoc/checks/coding/defaultcomeslast.xml.template +++ b/src/site/xdoc/checks/coding/defaultcomeslast.xml.template @@ -44,7 +44,7 @@ - +

    To configure the check to allow default label to be not last if it is shared with case:

    diff --git a/src/site/xdoc/checks/coding/equalsavoidnull.xml b/src/site/xdoc/checks/coding/equalsavoidnull.xml index 41bd2a19e93..091bb1ac078 100644 --- a/src/site/xdoc/checks/coding/equalsavoidnull.xml +++ b/src/site/xdoc/checks/coding/equalsavoidnull.xml @@ -74,8 +74,7 @@ public class Example1 { "My_Sweet_String".equalsIgnoreCase(nullString); } } - - +

    To configure the check to allow ignoreEqualsIgnoreCase:

    diff --git a/src/site/xdoc/checks/coding/equalsavoidnull.xml.template b/src/site/xdoc/checks/coding/equalsavoidnull.xml.template index 6054f4de135..ca3d760291c 100644 --- a/src/site/xdoc/checks/coding/equalsavoidnull.xml.template +++ b/src/site/xdoc/checks/coding/equalsavoidnull.xml.template @@ -51,8 +51,7 @@ - - +

    To configure the check to allow ignoreEqualsIgnoreCase:

    diff --git a/src/site/xdoc/checks/coding/explicitinitialization.xml b/src/site/xdoc/checks/coding/explicitinitialization.xml index f28beabfb5d..c0acc0ac926 100644 --- a/src/site/xdoc/checks/coding/explicitinitialization.xml +++ b/src/site/xdoc/checks/coding/explicitinitialization.xml @@ -79,7 +79,7 @@ public class Example1 { private int arrField2[] = new int[10]; private int arrField3[]; } - +

    To configure the check so that it only checks for objects that explicitly initialize to null: diff --git a/src/site/xdoc/checks/coding/explicitinitialization.xml.template b/src/site/xdoc/checks/coding/explicitinitialization.xml.template index 72c3e29cce7..fc0960b6c17 100644 --- a/src/site/xdoc/checks/coding/explicitinitialization.xml.template +++ b/src/site/xdoc/checks/coding/explicitinitialization.xml.template @@ -47,7 +47,7 @@ - +


    To configure the check so that it only checks for objects that explicitly initialize to null: diff --git a/src/site/xdoc/checks/coding/fallthrough.xml b/src/site/xdoc/checks/coding/fallthrough.xml index fc2cd121447..71c0cebf7a5 100644 --- a/src/site/xdoc/checks/coding/fallthrough.xml +++ b/src/site/xdoc/checks/coding/fallthrough.xml @@ -108,7 +108,7 @@ class Example1 { } } } - +


    To configure the check to enable check for last case group:

    @@ -153,7 +153,7 @@ class Example2 { } } } - +

    To configure the check with custom relief pattern:

    diff --git a/src/site/xdoc/checks/coding/fallthrough.xml.template b/src/site/xdoc/checks/coding/fallthrough.xml.template index 3e0b06e203f..58611d238e8 100644 --- a/src/site/xdoc/checks/coding/fallthrough.xml.template +++ b/src/site/xdoc/checks/coding/fallthrough.xml.template @@ -61,7 +61,7 @@ - +

    To configure the check to enable check for last case group:

    @@ -77,7 +77,7 @@ - +

    To configure the check with custom relief pattern:

    diff --git a/src/site/xdoc/checks/coding/finallocalvariable.xml b/src/site/xdoc/checks/coding/finallocalvariable.xml index b10d47cc8e9..21b9c0de23b 100644 --- a/src/site/xdoc/checks/coding/finallocalvariable.xml +++ b/src/site/xdoc/checks/coding/finallocalvariable.xml @@ -98,7 +98,7 @@ class Example1 int result=foo(1,2); // violation, 'Variable 'result' should be declared final' } } - +

    To configure the check so that it checks local variables and parameters: @@ -140,7 +140,7 @@ class Example2

    Option 'validateEnhancedForLoopVariable' could be used to make Check to validate even variable from Enhanced For Loop. -

    +


    An example of how to configure the check so that it also validates enhanced For Loop Variable is: @@ -172,7 +172,7 @@ class Example3 int result=foo(1,2); // violation, 'Variable 'result' should be declared final' } } - +


    An example of how to configure check on local variables and parameters but do not validate loop variables: diff --git a/src/site/xdoc/checks/coding/finallocalvariable.xml.template b/src/site/xdoc/checks/coding/finallocalvariable.xml.template index 42ba0fb5842..22d8df5d743 100644 --- a/src/site/xdoc/checks/coding/finallocalvariable.xml.template +++ b/src/site/xdoc/checks/coding/finallocalvariable.xml.template @@ -46,7 +46,7 @@ - +


    To configure the check so that it checks local variables and parameters: @@ -70,7 +70,7 @@

    Option 'validateEnhancedForLoopVariable' could be used to make Check to validate even variable from Enhanced For Loop. -

    +


    An example of how to configure the check so that it also validates enhanced For Loop Variable is: @@ -85,7 +85,7 @@ - +


    An example of how to configure check on local variables and parameters but do not validate loop variables: diff --git a/src/site/xdoc/checks/coding/hiddenfield.xml b/src/site/xdoc/checks/coding/hiddenfield.xml index 9d8c1f77dea..a28299b6cf8 100644 --- a/src/site/xdoc/checks/coding/hiddenfield.xml +++ b/src/site/xdoc/checks/coding/hiddenfield.xml @@ -165,8 +165,7 @@ class Example1 { abstract int method(String field); // violation, ''field' hides a field' } } - - +


    To configure the check so that it checks local variables but not parameters: @@ -203,8 +202,7 @@ class Example2 { abstract int method(String field); // OK, because PARAMETER_DEF not configured } } - - +


    To configure the check so that it ignores the variables and parameters named "test": @@ -241,8 +239,7 @@ class Example3 { abstract int method(String field); // violation, ''field' hides a field' } } - - +


    To configure the check so that it ignores constructor parameters:

    @@ -278,8 +275,7 @@ class Example4 { abstract int method(String field); // violation, ''field' hides a field' } } - - +

    To configure the check so that it ignores the parameter of setter methods: @@ -316,8 +312,7 @@ class Example5 { abstract int method(String field); // violation, ''field' hides a field' } } - - +


    To configure the check so that it ignores the parameter of setter methods recognizing setter as returning either void or @@ -356,7 +351,7 @@ class Example6 { abstract int method(String field); // violation, ''field' hides a field' } } - +


    To configure the check so that it ignores parameters of abstract methods:

    diff --git a/src/site/xdoc/checks/coding/hiddenfield.xml.template b/src/site/xdoc/checks/coding/hiddenfield.xml.template index df3f9c98cb2..d81a71ce213 100644 --- a/src/site/xdoc/checks/coding/hiddenfield.xml.template +++ b/src/site/xdoc/checks/coding/hiddenfield.xml.template @@ -74,8 +74,7 @@ class PageBuilder { - - +

    To configure the check so that it checks local variables but not parameters: @@ -90,8 +89,7 @@ class PageBuilder { - - +


    To configure the check so that it ignores the variables and parameters named "test": @@ -106,8 +104,7 @@ class PageBuilder { - - +


    To configure the check so that it ignores constructor parameters:

    @@ -121,8 +118,7 @@ class PageBuilder { - - +

    To configure the check so that it ignores the parameter of setter methods: @@ -137,8 +133,7 @@ class PageBuilder { - - +


    To configure the check so that it ignores the parameter of setter methods recognizing setter as returning either void or @@ -154,7 +149,7 @@ class PageBuilder { - +


    To configure the check so that it ignores parameters of abstract methods:

    diff --git a/src/site/xdoc/checks/coding/illegalcatch.xml b/src/site/xdoc/checks/coding/illegalcatch.xml index 66ceb815574..a978221a54c 100644 --- a/src/site/xdoc/checks/coding/illegalcatch.xml +++ b/src/site/xdoc/checks/coding/illegalcatch.xml @@ -104,7 +104,7 @@ class Example1 { } } } - +

    To configure the check to override the default list with ArithmeticException and OutOfMemoryError: diff --git a/src/site/xdoc/checks/coding/illegalcatch.xml.template b/src/site/xdoc/checks/coding/illegalcatch.xml.template index c78ef1e0e46..8810ab893b8 100644 --- a/src/site/xdoc/checks/coding/illegalcatch.xml.template +++ b/src/site/xdoc/checks/coding/illegalcatch.xml.template @@ -49,7 +49,7 @@ - +


    To configure the check to override the default list with ArithmeticException and OutOfMemoryError: diff --git a/src/site/xdoc/checks/coding/illegalinstantiation.xml b/src/site/xdoc/checks/coding/illegalinstantiation.xml index 2ba86b1b2e8..bc8bf2e4a7f 100644 --- a/src/site/xdoc/checks/coding/illegalinstantiation.xml +++ b/src/site/xdoc/checks/coding/illegalinstantiation.xml @@ -96,7 +96,7 @@ class Example1 { Integer f = Integer.valueOf(b); } } - +


    To configure the check to find instantiations of java.lang.Boolean and java.lang.Integer: @@ -133,7 +133,7 @@ class Example2 { Integer f = Integer.valueOf(b); } } - +


    Finally, there is a limitation that it is currently not possible to specify array classes:

    diff --git a/src/site/xdoc/checks/coding/illegalinstantiation.xml.template b/src/site/xdoc/checks/coding/illegalinstantiation.xml.template index 08464077aa4..abc62ce5a5c 100644 --- a/src/site/xdoc/checks/coding/illegalinstantiation.xml.template +++ b/src/site/xdoc/checks/coding/illegalinstantiation.xml.template @@ -65,7 +65,7 @@ - +

    To configure the check to find instantiations of java.lang.Boolean and java.lang.Integer: @@ -80,7 +80,7 @@ - +


    Finally, there is a limitation that it is currently not possible to specify array classes:

    diff --git a/src/site/xdoc/checks/coding/illegalthrows.xml b/src/site/xdoc/checks/coding/illegalthrows.xml index 6493b1c62c7..f47c6d1f219 100644 --- a/src/site/xdoc/checks/coding/illegalthrows.xml +++ b/src/site/xdoc/checks/coding/illegalthrows.xml @@ -77,7 +77,7 @@ public class Example1 { return str; } } - +

    To configure the check rejecting throws NullPointerException from methods:

    @@ -105,7 +105,7 @@ public class Example2 { return str; } } - +

    To configure the check ignoring method named "func1()":

    @@ -132,7 +132,7 @@ public class Example3 { return str; } } - +

    To configure the check to warn on overridden methods:

    diff --git a/src/site/xdoc/checks/coding/illegalthrows.xml.template b/src/site/xdoc/checks/coding/illegalthrows.xml.template index 2d48e796ab8..ee817d97b13 100644 --- a/src/site/xdoc/checks/coding/illegalthrows.xml.template +++ b/src/site/xdoc/checks/coding/illegalthrows.xml.template @@ -39,7 +39,7 @@ - +

    To configure the check rejecting throws NullPointerException from methods:

    @@ -53,7 +53,7 @@ - +

    To configure the check ignoring method named "func1()":

    @@ -67,7 +67,7 @@ - +

    To configure the check to warn on overridden methods:

    diff --git a/src/site/xdoc/checks/coding/illegaltoken.xml b/src/site/xdoc/checks/coding/illegaltoken.xml index 4c6d5bd834a..05d1b9b651b 100644 --- a/src/site/xdoc/checks/coding/illegaltoken.xml +++ b/src/site/xdoc/checks/coding/illegaltoken.xml @@ -72,7 +72,7 @@ class Example1 { } } } - +

    To configure the check to report violation on token LITERAL_NATIVE:

    diff --git a/src/site/xdoc/checks/coding/illegaltoken.xml.template b/src/site/xdoc/checks/coding/illegaltoken.xml.template index b148afafe28..65c0177b032 100644 --- a/src/site/xdoc/checks/coding/illegaltoken.xml.template +++ b/src/site/xdoc/checks/coding/illegaltoken.xml.template @@ -44,7 +44,7 @@ - +

    To configure the check to report violation on token LITERAL_NATIVE:

    diff --git a/src/site/xdoc/checks/coding/illegaltokentext.xml b/src/site/xdoc/checks/coding/illegaltokentext.xml index e1125aa5bd2..9b4894e2ee0 100644 --- a/src/site/xdoc/checks/coding/illegaltokentext.xml +++ b/src/site/xdoc/checks/coding/illegaltokentext.xml @@ -100,7 +100,7 @@ public class Example1 { String test2 = "A href"; // OK, case is sensitive } } - +

    To configure the check to forbid String literals containing "a href" for the ignoreCase mode: @@ -124,7 +124,7 @@ public class Example2 { String test2 = "A href"; // violation } } - +


    To configure the check to forbid string literal text blocks containing ": @@ -147,7 +147,7 @@ public class Example3 { \""""; // violation above } } - +


    To configure the check to forbid leading zeros in an integer literal, other than zero and a hex literal: diff --git a/src/site/xdoc/checks/coding/illegaltokentext.xml.template b/src/site/xdoc/checks/coding/illegaltokentext.xml.template index b3cf9f1d2f8..51502ba420d 100644 --- a/src/site/xdoc/checks/coding/illegaltokentext.xml.template +++ b/src/site/xdoc/checks/coding/illegaltokentext.xml.template @@ -39,7 +39,7 @@ - +


    To configure the check to forbid String literals containing "a href" for the ignoreCase mode: @@ -54,7 +54,7 @@ - +


    To configure the check to forbid string literal text blocks containing ": @@ -69,7 +69,7 @@ - +


    To configure the check to forbid leading zeros in an integer literal, other than zero and a hex literal: diff --git a/src/site/xdoc/checks/coding/illegaltype.xml b/src/site/xdoc/checks/coding/illegaltype.xml index 8ba879d17f2..73771ef59a8 100644 --- a/src/site/xdoc/checks/coding/illegaltype.xml +++ b/src/site/xdoc/checks/coding/illegaltype.xml @@ -246,7 +246,7 @@ public class Example1 extends TreeSet { var message = "Hello, World!"; } } - +


    To configure the Check so that particular tokens are checked:

    @@ -318,7 +318,7 @@ public class Example2 extends TreeSet { var message = "Hello, World!"; } } - +

    To configure the Check so that it ignores function() methods:

    @@ -391,7 +391,7 @@ public class Example3 extends TreeSet { var message = "Hello, World!"; } } - +

    To configure the Check so that it validates abstract class names:

    @@ -465,7 +465,7 @@ public class Example4 extends TreeSet { var message = "Hello, World!"; } } - +

    To configure the Check so that it verifies only public, protected or static methods and fields: @@ -540,7 +540,7 @@ public class Example5 extends TreeSet { var message = "Hello, World!"; } } - +


    To configure the check so that it verifies usage of types Boolean and Foo:

    @@ -614,7 +614,7 @@ public class Example6 extends TreeSet { var message = "Hello, World!"; } } - +

    To configure the check to target fields types only:

    @@ -692,7 +692,7 @@ public class Example7 extends TreeSet { var message = "Hello, World!"; } } - +

    To configure the check so that it violates usage of var:

    diff --git a/src/site/xdoc/checks/coding/illegaltype.xml.template b/src/site/xdoc/checks/coding/illegaltype.xml.template index 1b8e9c7de22..bbc65488b84 100644 --- a/src/site/xdoc/checks/coding/illegaltype.xml.template +++ b/src/site/xdoc/checks/coding/illegaltype.xml.template @@ -83,7 +83,7 @@ List list; //No violation here - +

    To configure the Check so that particular tokens are checked:

    @@ -97,7 +97,7 @@ List list; //No violation here - +

    To configure the Check so that it ignores function() methods:

    @@ -111,7 +111,7 @@ List list; //No violation here - +

    To configure the Check so that it validates abstract class names:

    @@ -125,7 +125,7 @@ List list; //No violation here - +

    To configure the Check so that it verifies only public, protected or static methods and fields: @@ -140,7 +140,7 @@ List list; //No violation here - +


    To configure the check so that it verifies usage of types Boolean and Foo:

    @@ -155,7 +155,7 @@ List list; //No violation here - +

    To configure the check to target fields types only:

    @@ -169,7 +169,7 @@ List list; //No violation here - +

    To configure the check so that it violates usage of var:

    diff --git a/src/site/xdoc/checks/coding/magicnumber.xml b/src/site/xdoc/checks/coding/magicnumber.xml index c250e07072f..5506707c6d7 100644 --- a/src/site/xdoc/checks/coding/magicnumber.xml +++ b/src/site/xdoc/checks/coding/magicnumber.xml @@ -223,8 +223,7 @@ public class Example1 { TestClass(int field) {} } } - - +

    To configure the check so that it checks floating-point numbers that are not 0, 0.5, or 1: @@ -280,7 +279,7 @@ public class Example2 { TestClass(int field) {} } } - +


    To configure the check so that it ignores magic numbers in field declarations:

    @@ -332,7 +331,7 @@ public class Example3 { TestClass(int field) {} } } - +

    To configure the check to check annotation element defaults:

    @@ -384,7 +383,7 @@ public class Example4 { TestClass(int field) {} } } - +

    Config example of constantWaiverParentToken option:

    @@ -445,8 +444,7 @@ public class Example5 { TestClass(int field) {} } } - - +

    Config example of ignoreHashCodeMethod option:

    diff --git a/src/site/xdoc/checks/coding/magicnumber.xml.template b/src/site/xdoc/checks/coding/magicnumber.xml.template index f21ee4fc167..8adf68e3fbd 100644 --- a/src/site/xdoc/checks/coding/magicnumber.xml.template +++ b/src/site/xdoc/checks/coding/magicnumber.xml.template @@ -56,8 +56,7 @@ static final Integer ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE = new Integer(42); - - +

    To configure the check so that it checks floating-point numbers that are not 0, 0.5, or 1: @@ -74,7 +73,7 @@ static final Integer ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE = new Integer(42); - +


    To configure the check so that it ignores magic numbers in field declarations:

    @@ -90,7 +89,7 @@ static final Integer ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE = new Integer(42); - +

    To configure the check to check annotation element defaults:

    @@ -106,7 +105,7 @@ static final Integer ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE = new Integer(42); - +

    Config example of constantWaiverParentToken option:

    @@ -120,8 +119,7 @@ static final Integer ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE = new Integer(42); - - +

    Config example of ignoreHashCodeMethod option:

    diff --git a/src/site/xdoc/checks/coding/matchxpath.xml b/src/site/xdoc/checks/coding/matchxpath.xml index 32b6ddbddad..ec1c570df9d 100644 --- a/src/site/xdoc/checks/coding/matchxpath.xml +++ b/src/site/xdoc/checks/coding/matchxpath.xml @@ -130,7 +130,7 @@ public class Example1 { public void method5() { } private void method6() { } } - +

    To violate if there are any parametrized constructors

    
     <module name="Checker">
    @@ -151,7 +151,7 @@ public class Example2 {
       public Example2(int a, HashMap<String, Integer> b) { } // violation
       public Example2() { }
     }
    -
    +

    To violate if method name is 'test' or 'foo'

    
     <module name="Checker">
    @@ -173,7 +173,7 @@ public class Example3 {
       public void foo() {} // violation
       public void sayHello() {}
     }
    -
    +

    To violate if new instance creation was done without var type

    diff --git a/src/site/xdoc/checks/coding/matchxpath.xml.template b/src/site/xdoc/checks/coding/matchxpath.xml.template index 013c09e721f..b37bd593578 100644 --- a/src/site/xdoc/checks/coding/matchxpath.xml.template +++ b/src/site/xdoc/checks/coding/matchxpath.xml.template @@ -105,7 +105,7 @@ CLASS_DEF -> CLASS_DEF [1:0] - +

    To violate if there are any parametrized constructors

    - +

    To violate if method name is 'test' or 'foo'

    - +

    To violate if new instance creation was done without var type

    diff --git a/src/site/xdoc/checks/coding/missingswitchdefault.xml b/src/site/xdoc/checks/coding/missingswitchdefault.xml index 5e866015683..17ada77b2e8 100644 --- a/src/site/xdoc/checks/coding/missingswitchdefault.xml +++ b/src/site/xdoc/checks/coding/missingswitchdefault.xml @@ -81,7 +81,7 @@ class Example1 { } } } - +

    Example of correct code:

    @@ -110,7 +110,7 @@ class Example2 { } } } - +

    Example of correct code which does not require default labels:

    diff --git a/src/site/xdoc/checks/coding/missingswitchdefault.xml.template b/src/site/xdoc/checks/coding/missingswitchdefault.xml.template index 09809f7015d..8322604355e 100644 --- a/src/site/xdoc/checks/coding/missingswitchdefault.xml.template +++ b/src/site/xdoc/checks/coding/missingswitchdefault.xml.template @@ -61,7 +61,7 @@ - +

    Example of correct code:

    @@ -69,7 +69,7 @@ - +

    Example of correct code which does not require default labels:

    diff --git a/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml b/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml index 192ae8ca34a..59e87d6c5b1 100644 --- a/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml +++ b/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml @@ -100,7 +100,7 @@ class Example1 {

    Option 'skipEnhancedForLoopVariable' could be used to skip check of variable from Enhanced For Loop. -

    +


    An example of how to configure the check so that it skips enhanced For Loop Variable is:

    diff --git a/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml.template b/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml.template index a38305562d7..55fb27f9e48 100644 --- a/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml.template +++ b/src/site/xdoc/checks/coding/modifiedcontrolvariable.xml.template @@ -77,7 +77,7 @@ for (int a[]={0};a[0] < 10;a[0]++) {

    Option 'skipEnhancedForLoopVariable' could be used to skip check of variable from Enhanced For Loop. -

    +


    An example of how to configure the check so that it skips enhanced For Loop Variable is:

    diff --git a/src/site/xdoc/checks/coding/multiplestringliterals.xml b/src/site/xdoc/checks/coding/multiplestringliterals.xml index c892a8f10cd..60baba107c5 100644 --- a/src/site/xdoc/checks/coding/multiplestringliterals.xml +++ b/src/site/xdoc/checks/coding/multiplestringliterals.xml @@ -82,7 +82,7 @@ public class Example1 { String a5 = ", " + ", " + ", "; // violation, ", " occurs three times } } - +

    To configure the check so that it allows two occurrences of each string: @@ -109,7 +109,7 @@ public class Example2 { String a5 = ", " + ", " + ", "; // violation, three occurrences are NOT allowed } } - +


    To configure the check so that it ignores ", " and empty strings:

    @@ -136,7 +136,7 @@ public class Example3 { String a5 = ", " + ", " + ", "; // OK, multiple occurrences of ", " are allowed } } - +

    To configure the check so that it flags duplicate strings in all syntactical contexts, even in annotations like diff --git a/src/site/xdoc/checks/coding/multiplestringliterals.xml.template b/src/site/xdoc/checks/coding/multiplestringliterals.xml.template index 46b9fb320fb..d2b0e98b912 100644 --- a/src/site/xdoc/checks/coding/multiplestringliterals.xml.template +++ b/src/site/xdoc/checks/coding/multiplestringliterals.xml.template @@ -43,7 +43,7 @@ - +


    To configure the check so that it allows two occurrences of each string: @@ -58,7 +58,7 @@ - +


    To configure the check so that it ignores ", " and empty strings:

    @@ -72,7 +72,7 @@ - +

    To configure the check so that it flags duplicate strings in all syntactical contexts, even in annotations like diff --git a/src/site/xdoc/checks/coding/nestedfordepth.xml b/src/site/xdoc/checks/coding/nestedfordepth.xml index deff1227a4d..d5d0c8ba444 100644 --- a/src/site/xdoc/checks/coding/nestedfordepth.xml +++ b/src/site/xdoc/checks/coding/nestedfordepth.xml @@ -74,7 +74,7 @@ public class Example1 { } } } - +


    To configure the check to allow nesting depth 2:

    diff --git a/src/site/xdoc/checks/coding/nestedfordepth.xml.template b/src/site/xdoc/checks/coding/nestedfordepth.xml.template index 2ff1ea97f88..694df8b697f 100644 --- a/src/site/xdoc/checks/coding/nestedfordepth.xml.template +++ b/src/site/xdoc/checks/coding/nestedfordepth.xml.template @@ -35,7 +35,7 @@ - +

    To configure the check to allow nesting depth 2:

    diff --git a/src/site/xdoc/checks/coding/nestedifdepth.xml b/src/site/xdoc/checks/coding/nestedifdepth.xml index 7133dd2f716..b6dbdc29aeb 100644 --- a/src/site/xdoc/checks/coding/nestedifdepth.xml +++ b/src/site/xdoc/checks/coding/nestedifdepth.xml @@ -83,7 +83,7 @@ class Example1 { } } } - +

    To configure the check to allow nesting depth 3:

    diff --git a/src/site/xdoc/checks/coding/nestedifdepth.xml.template b/src/site/xdoc/checks/coding/nestedifdepth.xml.template index bec1c088290..77b439f0ad6 100644 --- a/src/site/xdoc/checks/coding/nestedifdepth.xml.template +++ b/src/site/xdoc/checks/coding/nestedifdepth.xml.template @@ -35,7 +35,7 @@ - +

    To configure the check to allow nesting depth 3:

    diff --git a/src/site/xdoc/checks/coding/nestedtrydepth.xml b/src/site/xdoc/checks/coding/nestedtrydepth.xml index 7b4c5155684..016e133431d 100644 --- a/src/site/xdoc/checks/coding/nestedtrydepth.xml +++ b/src/site/xdoc/checks/coding/nestedtrydepth.xml @@ -74,7 +74,7 @@ public class Example1 { } catch (Exception e) {} } } - +

    To configure the check to allow nesting depth 3:

    diff --git a/src/site/xdoc/checks/coding/nestedtrydepth.xml.template b/src/site/xdoc/checks/coding/nestedtrydepth.xml.template index e4d0ec15eee..cba95e41d61 100644 --- a/src/site/xdoc/checks/coding/nestedtrydepth.xml.template +++ b/src/site/xdoc/checks/coding/nestedtrydepth.xml.template @@ -37,7 +37,7 @@ - +

    To configure the check to allow nesting depth 3:

    diff --git a/src/site/xdoc/checks/coding/onestatementperline.xml b/src/site/xdoc/checks/coding/onestatementperline.xml index 2e6a1917f59..9c23e88516f 100644 --- a/src/site/xdoc/checks/coding/onestatementperline.xml +++ b/src/site/xdoc/checks/coding/onestatementperline.xml @@ -101,7 +101,7 @@ public class Example1 { } } - +

    An example of how to configure the check to treat resources in a try statement as statements to require them on their own line: diff --git a/src/site/xdoc/checks/coding/onestatementperline.xml.template b/src/site/xdoc/checks/coding/onestatementperline.xml.template index ddbbd4acb7d..a8d557013c0 100644 --- a/src/site/xdoc/checks/coding/onestatementperline.xml.template +++ b/src/site/xdoc/checks/coding/onestatementperline.xml.template @@ -54,7 +54,7 @@ - +


    An example of how to configure the check to treat resources in a try statement as statements to require them on their own line: diff --git a/src/site/xdoc/checks/coding/packagedeclaration.xml b/src/site/xdoc/checks/coding/packagedeclaration.xml index 40614415d5a..288432a111b 100644 --- a/src/site/xdoc/checks/coding/packagedeclaration.xml +++ b/src/site/xdoc/checks/coding/packagedeclaration.xml @@ -62,7 +62,7 @@ public class Example1{ // violation, 'Missing package declaration' String str = "Some Content"; } - +


    Example of how the check works when matchDirectoryStructure option is set to false.

    diff --git a/src/site/xdoc/checks/coding/packagedeclaration.xml.template b/src/site/xdoc/checks/coding/packagedeclaration.xml.template index bbf39c311d4..e30ddd20198 100644 --- a/src/site/xdoc/checks/coding/packagedeclaration.xml.template +++ b/src/site/xdoc/checks/coding/packagedeclaration.xml.template @@ -48,7 +48,7 @@ - +

    Example of how the check works when matchDirectoryStructure option is set to false.

    diff --git a/src/site/xdoc/checks/coding/requirethis.xml b/src/site/xdoc/checks/coding/requirethis.xml index 50c728e0273..b74a0c069ef 100644 --- a/src/site/xdoc/checks/coding/requirethis.xml +++ b/src/site/xdoc/checks/coding/requirethis.xml @@ -116,7 +116,7 @@ class Example1 {

    Note that method call foo(5) does not raise a violation because methods cannot be overlapped in java. -

    +


    To configure the check demand methods and fields to have 'this.'

    @@ -149,7 +149,7 @@ class Example4 { field3 = field3; } } - +

    To configure the check demand fields only to have 'this.'

    @@ -183,7 +183,7 @@ class Example2 { field3 = field3; } } - +

    To configure the check demand methods only to have 'this.'

    diff --git a/src/site/xdoc/checks/coding/requirethis.xml.template b/src/site/xdoc/checks/coding/requirethis.xml.template index b734251bf91..48068841145 100644 --- a/src/site/xdoc/checks/coding/requirethis.xml.template +++ b/src/site/xdoc/checks/coding/requirethis.xml.template @@ -73,7 +73,7 @@

    Note that method call foo(5) does not raise a violation because methods cannot be overlapped in java. -

    +


    To configure the check demand methods and fields to have 'this.'

    @@ -87,7 +87,7 @@ - +

    To configure the check demand fields only to have 'this.'

    @@ -101,7 +101,7 @@ - +

    To configure the check demand methods only to have 'this.'

    diff --git a/src/site/xdoc/checks/coding/returncount.xml b/src/site/xdoc/checks/coding/returncount.xml index 090dc5e58d2..e4a2900cb7d 100644 --- a/src/site/xdoc/checks/coding/returncount.xml +++ b/src/site/xdoc/checks/coding/returncount.xml @@ -138,8 +138,7 @@ public class Example1 { // ok below, because default void restriction is 1 public void methodB(int x) { return; } } - - +

    To configure the check so that it doesn't allow any return statements per void method: @@ -185,8 +184,7 @@ public class Example2 { // violation below, 'max allowed for void methods/constructors/lambdas is 0' public void methodB(int x) { return; } } - - +


    To configure the check so that it doesn't allow more than 2 return statements per method (ignoring the equals() @@ -234,8 +232,7 @@ public class Example3 { // ok below, because default void restriction is 1 public void methodB(int x) { return; } } - - +


    To configure the check so that it doesn't allow more than three return statements per method for all methods: @@ -282,8 +279,7 @@ public class Example4 { // ok below, because default void restriction is 1 public void methodB(int x) { return; } } - - +


    To configure the check so that it doesn't allow any return statements in constructors, more than one return statement in all lambda diff --git a/src/site/xdoc/checks/coding/returncount.xml.template b/src/site/xdoc/checks/coding/returncount.xml.template index a6a9e990fcb..53726c0ae13 100644 --- a/src/site/xdoc/checks/coding/returncount.xml.template +++ b/src/site/xdoc/checks/coding/returncount.xml.template @@ -60,8 +60,7 @@ - - +


    To configure the check so that it doesn't allow any return statements per void method: @@ -78,8 +77,7 @@ - - +


    To configure the check so that it doesn't allow more than 2 return statements per method (ignoring the equals() @@ -97,8 +95,7 @@ - - +


    To configure the check so that it doesn't allow more than three return statements per method for all methods: @@ -115,8 +112,7 @@ - - +


    To configure the check so that it doesn't allow any return statements in constructors, more than one return statement in all lambda diff --git a/src/site/xdoc/checks/coding/unnecessaryparentheses.xml b/src/site/xdoc/checks/coding/unnecessaryparentheses.xml index 396dfe153c3..7ce8384df19 100644 --- a/src/site/xdoc/checks/coding/unnecessaryparentheses.xml +++ b/src/site/xdoc/checks/coding/unnecessaryparentheses.xml @@ -334,7 +334,7 @@ class Example1 { } } - +


    To configure the check to detect unnecessary parentheses around bitwise inclusive OR '|' , bitwise AND '&' , bitwise exclusive OR @@ -377,7 +377,7 @@ class Example2 { } } - +


    To configure the check to detect unnecessary parentheses around conditional expressions '?' : diff --git a/src/site/xdoc/checks/coding/unnecessaryparentheses.xml.template b/src/site/xdoc/checks/coding/unnecessaryparentheses.xml.template index d193227e731..1711f0d69b7 100644 --- a/src/site/xdoc/checks/coding/unnecessaryparentheses.xml.template +++ b/src/site/xdoc/checks/coding/unnecessaryparentheses.xml.template @@ -100,7 +100,7 @@ if ((++f) > g && a) { // violation, unnecessary paren - +


    To configure the check to detect unnecessary parentheses around bitwise inclusive OR '|' , bitwise AND '&' , bitwise exclusive OR @@ -116,7 +116,7 @@ if ((++f) > g && a) { // violation, unnecessary paren - +


    To configure the check to detect unnecessary parentheses around conditional expressions '?' : diff --git a/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml b/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml index 566cd9bb933..1660c0643bf 100644 --- a/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml +++ b/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml @@ -98,7 +98,7 @@ enum C { @interface D { }; // violation 'Unnecessary semicolon' - +


    To configure the check to detect unnecessary semicolon only after top level class definitions: diff --git a/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml.template b/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml.template index da24e2d05af..e8f48ad40b1 100644 --- a/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml.template +++ b/src/site/xdoc/checks/coding/unnecessarysemicolonafteroutertypedeclaration.xml.template @@ -45,7 +45,7 @@ - +


    To configure the check to detect unnecessary semicolon only after top level class definitions: diff --git a/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml b/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml index fc9a2c8638a..9449ada10cc 100644 --- a/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml +++ b/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml @@ -47,7 +47,7 @@ enum Five { B ; // violation 'Unnecessary semicolon' } - +


    Example of good cases

    diff --git a/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml.template b/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml.template index d5970c8073c..f248644de01 100644 --- a/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml.template +++ b/src/site/xdoc/checks/coding/unnecessarysemicoloninenumeration.xml.template @@ -31,7 +31,7 @@ - +

    Example of good cases

    diff --git a/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml b/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml index 5f6f1327e5a..900c2fbf738 100644 --- a/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml +++ b/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml @@ -61,7 +61,7 @@ class Example1 { ) {} } } - +

    To configure the check to detect unnecessary semicolon if closing parenthesis is not on the same line diff --git a/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml.template b/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml.template index 2cb70f2b009..155cef544e2 100644 --- a/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml.template +++ b/src/site/xdoc/checks/coding/unnecessarysemicolonintrywithresources.xml.template @@ -39,7 +39,7 @@ - +


    To configure the check to detect unnecessary semicolon if closing parenthesis is not on the same line diff --git a/src/site/xdoc/checks/coding/unusedlocalvariable.xml b/src/site/xdoc/checks/coding/unusedlocalvariable.xml index 780d7e9f32b..cf5de70053d 100644 --- a/src/site/xdoc/checks/coding/unusedlocalvariable.xml +++ b/src/site/xdoc/checks/coding/unusedlocalvariable.xml @@ -100,7 +100,7 @@ class Example1 { obj.test("Test"); } } - +


    To configure the check to violate variables named with a single underscore if they are not used: diff --git a/src/site/xdoc/checks/coding/unusedlocalvariable.xml.template b/src/site/xdoc/checks/coding/unusedlocalvariable.xml.template index 99686cfbe5a..26c23f1b9b4 100644 --- a/src/site/xdoc/checks/coding/unusedlocalvariable.xml.template +++ b/src/site/xdoc/checks/coding/unusedlocalvariable.xml.template @@ -42,7 +42,7 @@ - +


    To configure the check to violate variables named with a single underscore if they are not used: diff --git a/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml b/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml index 9ab8debad39..39ba6c61c3d 100644 --- a/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml +++ b/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml @@ -11,8 +11,8 @@

    Checks the distance between declaration of variable and its first usage. - Note : Variable declaration/initialization statements are not counted - while calculating length. + Note: Any additional variables declared or initialized between the declaration and + the first usage of the said variable are not counted when calculating the distance.
    @@ -134,7 +134,7 @@ cal.set(Calendar.MINUTE, minutes);

    The distance for the variable "minutes" is 6 because there is one more expression (except the initialization block) between the declaration of this variable and its usage. -

    +


    To configure the check to set allowed distance:

    @@ -174,7 +174,7 @@ public class Example2 { } } } - +

    To configure the check to ignore certain variables:

    @@ -217,7 +217,7 @@ public class Example3 { } } } - +

    To configure the check to force validation between scopes:

    @@ -257,7 +257,7 @@ public class Example4 { } } } - +

    To configure the check to check final variables:

    diff --git a/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml.template b/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml.template index b1198d3e4c9..9018c56c2c0 100644 --- a/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml.template +++ b/src/site/xdoc/checks/coding/variabledeclarationusagedistance.xml.template @@ -11,8 +11,8 @@
    Checks the distance between declaration of variable and its first usage. - Note : Variable declaration/initialization statements are not counted - while calculating length. + Note: Any additional variables declared or initialized between the declaration and + the first usage of the said variable are not counted when calculating the distance.
    @@ -77,7 +77,7 @@ cal.set(Calendar.MINUTE, minutes);

    The distance for the variable "minutes" is 6 because there is one more expression (except the initialization block) between the declaration of this variable and its usage. -

    +


    To configure the check to set allowed distance:

    @@ -91,7 +91,7 @@ cal.set(Calendar.MINUTE, minutes); - +

    To configure the check to ignore certain variables:

    @@ -108,7 +108,7 @@ cal.set(Calendar.MINUTE, minutes); - +

    To configure the check to force validation between scopes:

    @@ -122,7 +122,7 @@ cal.set(Calendar.MINUTE, minutes); - +

    To configure the check to check final variables:

    diff --git a/src/site/xdoc/checks/design/designforextension.xml b/src/site/xdoc/checks/design/designforextension.xml index 2a2282a4c41..599febef512 100644 --- a/src/site/xdoc/checks/design/designforextension.xml +++ b/src/site/xdoc/checks/design/designforextension.xml @@ -204,8 +204,7 @@ public abstract class Example1 { return ""; } } - - +

    To configure the check to allow methods which have @Override annotations to be designed for extension. @@ -256,8 +255,7 @@ public abstract class Example2 { return ""; } } - - +


    To configure the check to allow methods which contain a specified comment text pattern in their javadoc to be designed for extension. @@ -308,8 +306,7 @@ public abstract class Example3 { 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. diff --git a/src/site/xdoc/checks/design/designforextension.xml.template b/src/site/xdoc/checks/design/designforextension.xml.template index 2fda56d771e..1cf6ae472ab 100644 --- a/src/site/xdoc/checks/design/designforextension.xml.template +++ b/src/site/xdoc/checks/design/designforextension.xml.template @@ -151,8 +151,7 @@ public abstract class Plant { - - +


    To configure the check to allow methods which have @Override annotations to be designed for extension. @@ -167,8 +166,7 @@ public abstract class Plant { - - +


    To configure the check to allow methods which contain a specified comment text pattern in their javadoc to be designed for extension. @@ -183,8 +181,7 @@ public abstract class Plant { - - +


    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. diff --git a/src/site/xdoc/checks/design/hideutilityclassconstructor.xml b/src/site/xdoc/checks/design/hideutilityclassconstructor.xml index 2eb56167af8..9c71eea9e19 100644 --- a/src/site/xdoc/checks/design/hideutilityclassconstructor.xml +++ b/src/site/xdoc/checks/design/hideutilityclassconstructor.xml @@ -115,8 +115,7 @@ class Application1 { public static void main(String[] args) { } } - - +


    To configure the check to ignore classes annotated with SpringBootApplication or java.lang.Deprecated. diff --git a/src/site/xdoc/checks/design/hideutilityclassconstructor.xml.template b/src/site/xdoc/checks/design/hideutilityclassconstructor.xml.template index c0bea4ac61d..a0d0615c8c2 100644 --- a/src/site/xdoc/checks/design/hideutilityclassconstructor.xml.template +++ b/src/site/xdoc/checks/design/hideutilityclassconstructor.xml.template @@ -65,8 +65,7 @@ public class StringUtils // not final to allow subclassing - - +


    To configure the check to ignore classes annotated with SpringBootApplication or java.lang.Deprecated. diff --git a/src/site/xdoc/checks/design/interfaceistype.xml b/src/site/xdoc/checks/design/interfaceistype.xml index e7810c76ff3..7bc1e6e7b0d 100644 --- a/src/site/xdoc/checks/design/interfaceistype.xml +++ b/src/site/xdoc/checks/design/interfaceistype.xml @@ -79,7 +79,7 @@ class Example1 { void test(); } } - +


    To configure the check to report violation so that it doesn't allow Marker Interfaces:

    diff --git a/src/site/xdoc/checks/design/interfaceistype.xml.template b/src/site/xdoc/checks/design/interfaceistype.xml.template index 7dfb9202a7f..790ba1166e3 100644 --- a/src/site/xdoc/checks/design/interfaceistype.xml.template +++ b/src/site/xdoc/checks/design/interfaceistype.xml.template @@ -52,7 +52,7 @@ - +

    To configure the check to report violation so that it doesn't allow Marker Interfaces:

    diff --git a/src/site/xdoc/checks/design/mutableexception.xml b/src/site/xdoc/checks/design/mutableexception.xml index 57f92d9957f..4ade7419f58 100644 --- a/src/site/xdoc/checks/design/mutableexception.xml +++ b/src/site/xdoc/checks/design/mutableexception.xml @@ -107,8 +107,7 @@ class FirstBadException extends java.lang.Exception { this.code = code; } } - - +

    To configure the check so that it checks for class name that ends with 'Exception': @@ -157,8 +156,7 @@ class SecondBadException extends java.lang.Exception { this.code = code; } } - - +


    To configure the check so that it checks for type name that is used in 'extends' and ends with 'Throwable': diff --git a/src/site/xdoc/checks/design/mutableexception.xml.template b/src/site/xdoc/checks/design/mutableexception.xml.template index 39f1acea934..c6de56537dc 100644 --- a/src/site/xdoc/checks/design/mutableexception.xml.template +++ b/src/site/xdoc/checks/design/mutableexception.xml.template @@ -56,8 +56,7 @@ - - +


    To configure the check so that it checks for class name that ends with 'Exception': @@ -72,8 +71,7 @@ - - +


    To configure the check so that it checks for type name that is used in 'extends' and ends with 'Throwable': diff --git a/src/site/xdoc/checks/design/onetoplevelclass.xml b/src/site/xdoc/checks/design/onetoplevelclass.xml index 0809969e78f..22ad562a69f 100644 --- a/src/site/xdoc/checks/design/onetoplevelclass.xml +++ b/src/site/xdoc/checks/design/onetoplevelclass.xml @@ -45,7 +45,7 @@ public class Example1 { // OK, first top-level class class ViolationExample1 { // violation, "has to reside in its own source file." // methods } - +


    An example of code without public top-level type:

    @@ -57,7 +57,7 @@ class Example2 { // OK, first top-level class class ViolationExample2 { // violation, "has to reside in its own source file." // methods } - +

    An example of code without violations:

    diff --git a/src/site/xdoc/checks/design/onetoplevelclass.xml.template b/src/site/xdoc/checks/design/onetoplevelclass.xml.template index a6fc7c660c0..919781fc5b7 100644 --- a/src/site/xdoc/checks/design/onetoplevelclass.xml.template +++ b/src/site/xdoc/checks/design/onetoplevelclass.xml.template @@ -39,7 +39,7 @@ - +

    An example of code without public top-level type:

    @@ -47,7 +47,7 @@ - +

    An example of code without violations:

    diff --git a/src/site/xdoc/checks/design/throwscount.xml b/src/site/xdoc/checks/design/throwscount.xml index 42b292e2d15..dd827517c29 100644 --- a/src/site/xdoc/checks/design/throwscount.xml +++ b/src/site/xdoc/checks/design/throwscount.xml @@ -104,7 +104,7 @@ public class Example1 { NullPointerException { } } - +

    To configure the check so that it doesn't allow more than two throws per method: @@ -147,7 +147,7 @@ public class Example2 { NullPointerException { } } - +


    To configure the check so that it doesn't skip private methods:

    diff --git a/src/site/xdoc/checks/design/throwscount.xml.template b/src/site/xdoc/checks/design/throwscount.xml.template index 9d47e8e5c57..6c950615b83 100644 --- a/src/site/xdoc/checks/design/throwscount.xml.template +++ b/src/site/xdoc/checks/design/throwscount.xml.template @@ -61,7 +61,7 @@ - +

    To configure the check so that it doesn't allow more than two throws per method: @@ -78,7 +78,7 @@ - +


    To configure the check so that it doesn't skip private methods:

    diff --git a/src/site/xdoc/checks/design/visibilitymodifier.xml b/src/site/xdoc/checks/design/visibilitymodifier.xml index da8a15faab8..2c5b254ac01 100644 --- a/src/site/xdoc/checks/design/visibilitymodifier.xml +++ b/src/site/xdoc/checks/design/visibilitymodifier.xml @@ -192,7 +192,7 @@ class Example1 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +

    To configure the check so that it allows package visible members:

    @@ -245,7 +245,7 @@ class Example2 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +

    To configure the check so that it allows protected visible members:

    @@ -299,7 +299,7 @@ class Example3 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +

    To configure the check so that it allows no public members:

    @@ -354,7 +354,7 @@ class Example4 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +

    To configure the Check so that it allows public immutable fields (mostly for immutable classes): @@ -409,7 +409,7 @@ class Example5 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +


    To configure the Check in order to allow user specified immutable class names:

    @@ -466,7 +466,7 @@ class Example6 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +

    Note, if allowPublicImmutableFields is set to true, the check will also check whether generic type parameters are immutable. If at least one generic type parameter is mutable, @@ -525,7 +525,7 @@ class Example7 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +


    To configure the Check passing fields annotated with @java.lang.Deprecated:

    @@ -580,8 +580,7 @@ class Example8 { // violation below, annotation not configured 'must be private' public String testString = ""; } - - +

    To configure the Check passing fields annotated with @org.junit.Rule, @org.junit.ClassRule and @com.google.common.annotations.VisibleForTesting annotations: @@ -634,7 +633,7 @@ class Example9 { @com.google.common.annotations.VisibleForTesting public String testString = ""; } - +


    To configure the Check passing fields annotated with short annotation name:

    @@ -692,7 +691,7 @@ class Example10 {

    To understand the difference between allowPublicImmutableFields and allowPublicFinalFields options, please, study the following examples. -

    +


    1) To configure the check to use only 'allowPublicImmutableFields' option:

    @@ -720,7 +719,7 @@ class Example11 { public final List list = null; // violation 'must be private' } - +

    2) To configure the check to use only 'allowPublicFinalFields' option:

    diff --git a/src/site/xdoc/checks/design/visibilitymodifier.xml.template b/src/site/xdoc/checks/design/visibilitymodifier.xml.template index 10cc894b50a..350bd6e7f6a 100644 --- a/src/site/xdoc/checks/design/visibilitymodifier.xml.template +++ b/src/site/xdoc/checks/design/visibilitymodifier.xml.template @@ -101,7 +101,7 @@ - +

    To configure the check so that it allows package visible members:

    @@ -115,7 +115,7 @@ - +

    To configure the check so that it allows protected visible members:

    @@ -129,7 +129,7 @@ - +

    To configure the check so that it allows no public members:

    @@ -143,7 +143,7 @@ - +

    To configure the Check so that it allows public immutable fields (mostly for immutable classes): @@ -160,7 +160,7 @@ - +


    To configure the Check in order to allow user specified immutable class names:

    @@ -176,7 +176,7 @@ - +

    Note, if allowPublicImmutableFields is set to true, the check will also check whether generic type parameters are immutable. If at least one generic type parameter is mutable, @@ -194,7 +194,7 @@ - +


    To configure the Check passing fields annotated with @java.lang.Deprecated:

    @@ -210,8 +210,7 @@ - - +

    To configure the Check passing fields annotated with @org.junit.Rule, @org.junit.ClassRule and @com.google.common.annotations.VisibleForTesting annotations: @@ -228,7 +227,7 @@ - +


    To configure the Check passing fields annotated with short annotation name:

    @@ -248,7 +247,7 @@

    To understand the difference between allowPublicImmutableFields and allowPublicFinalFields options, please, study the following examples. -

    +


    1) To configure the check to use only 'allowPublicImmutableFields' option:

    @@ -264,7 +263,7 @@ - +

    2) To configure the check to use only 'allowPublicFinalFields' option:

    diff --git a/src/site/xdoc/checks/header/header.xml b/src/site/xdoc/checks/header/header.xml index 315eced9388..ce858ee3d29 100644 --- a/src/site/xdoc/checks/header/header.xml +++ b/src/site/xdoc/checks/header/header.xml @@ -91,8 +91,7 @@ package com.puppycrawl.tools.checkstyle.checks.header.header; // OK, as by default there is not specific header defined to validate it presence public class Example1 { } - - +

    To configure the check to use header file "java.header" and ignore lines 2, 3, and 4 and only process Java @@ -136,8 +135,7 @@ package com.puppycrawl.tools.checkstyle.checks.header.header; /* violation on first line 'Line does not match expected header line of' */ // because headerFile is bigger then target java file public class Example2 { } - - +


    Without the need for an external header file:

    @@ -154,8 +152,7 @@ public class Example2 { } package com.puppycrawl.tools.checkstyle.checks.header.header; /* violation on first line 'Line does not match expected header' */ public class Example3 { } - - +

    In case target file is less in size than header file:

    diff --git a/src/site/xdoc/checks/header/header.xml.template b/src/site/xdoc/checks/header/header.xml.template index 68d43e118ca..ece5475aa8a 100644 --- a/src/site/xdoc/checks/header/header.xml.template +++ b/src/site/xdoc/checks/header/header.xml.template @@ -51,8 +51,7 @@ - - +

    To configure the check to use header file "java.header" and ignore lines 2, 3, and 4 and only process Java @@ -76,8 +75,7 @@ - - +


    Without the need for an external header file:

    @@ -91,8 +89,7 @@ - - +

    In case target file is less in size than header file:

    diff --git a/src/site/xdoc/checks/header/regexpheader.xml b/src/site/xdoc/checks/header/regexpheader.xml index 1a80daef7db..b2ad40aa90d 100644 --- a/src/site/xdoc/checks/header/regexpheader.xml +++ b/src/site/xdoc/checks/header/regexpheader.xml @@ -80,8 +80,7 @@ package com.puppycrawl.tools.checkstyle.checks.header.header; // OK, as by default there is not specific header defined to validate it presence public class Example1 { } - - +

    To configure the check to use header file "java.header" and 10 and 13 multi-lines: @@ -121,8 +120,7 @@ package com.puppycrawl.tools.checkstyle.checks.header.header; /* violation on first line 'Line does not match expected header line of' */ // because headerFile is bigger then target java file public class Example2 { } - - +


    To configure the check to verify that each file starts with the header @@ -142,8 +140,7 @@ public class Example2 { } package com.puppycrawl.tools.checkstyle.checks.header.regexpheader; /* violation on first line 'Line does not match expected header line' */ public class Example3 { } - - +


    For regex containing ".*"

    diff --git a/src/site/xdoc/checks/header/regexpheader.xml.template b/src/site/xdoc/checks/header/regexpheader.xml.template index 0f23d1642c5..fec1a7b88e8 100644 --- a/src/site/xdoc/checks/header/regexpheader.xml.template +++ b/src/site/xdoc/checks/header/regexpheader.xml.template @@ -40,8 +40,7 @@ - - +

    To configure the check to use header file "java.header" and 10 and 13 multi-lines: @@ -62,8 +61,7 @@ - - +


    To configure the check to verify that each file starts with the header @@ -78,8 +76,7 @@ - - +


    For regex containing ".*"

    diff --git a/src/site/xdoc/checks/imports/avoidstarimport.xml b/src/site/xdoc/checks/imports/avoidstarimport.xml index 6184fa4d76c..bc0e2798676 100644 --- a/src/site/xdoc/checks/imports/avoidstarimport.xml +++ b/src/site/xdoc/checks/imports/avoidstarimport.xml @@ -83,7 +83,7 @@ import java.io.*; // violation, 'Using the '.*' form of import should be avoided import static java.lang.Math.*; // violation, 'form of import should be avoided.' import java.util.*; // violation, 'Using the '.*' form of import should be avoided.' import java.net.*; // violation, 'Using the '.*' form of import should be avoided.' - +

    To configure the check so that star imports from packages java.io and java.net as well as static members from class @@ -107,7 +107,7 @@ import java.io.*; import static java.lang.Math.*; import java.util.*; // violation, 'Using the '.*' form of import should be avoided.' import java.net.*; - +


    To configure the check so that star imports from all packages are allowed: @@ -130,7 +130,7 @@ import java.io.*; import static java.lang.Math.*; // violation, 'form of import should be avoided.' import java.util.*; import java.net.*; - +


    To configure the check so that starred static member imports from all packages are allowed: @@ -153,7 +153,7 @@ import java.io.*; // violation, 'Using the '.*' form of import should be avoided import static java.lang.Math.*; import java.util.*; // violation, 'Using the '.*' form of import should be avoided.' import java.net.*; // violation, 'Using the '.*' form of import should be avoided.' - +


    To configure the check so that star imports from packages java.io and java.net are allowed: @@ -177,7 +177,7 @@ import java.io.*; import static java.lang.Math.*; // violation, 'form of import should be avoided.' import java.util.*; import java.net.*; - +


    To configure the check so that star imports from packages java.io and java.net as well as static members imports diff --git a/src/site/xdoc/checks/imports/avoidstarimport.xml.template b/src/site/xdoc/checks/imports/avoidstarimport.xml.template index 1a61667a843..253fc7b9a16 100644 --- a/src/site/xdoc/checks/imports/avoidstarimport.xml.template +++ b/src/site/xdoc/checks/imports/avoidstarimport.xml.template @@ -53,7 +53,7 @@ - +


    To configure the check so that star imports from packages java.io and java.net as well as static members from class @@ -71,7 +71,7 @@ - +


    To configure the check so that star imports from all packages are allowed: @@ -88,7 +88,7 @@ - +


    To configure the check so that starred static member imports from all packages are allowed: @@ -105,7 +105,7 @@ - +


    To configure the check so that star imports from packages java.io and java.net are allowed: @@ -122,7 +122,7 @@ - +


    To configure the check so that star imports from packages java.io and java.net as well as static members imports diff --git a/src/site/xdoc/checks/imports/avoidstaticimport.xml b/src/site/xdoc/checks/imports/avoidstaticimport.xml index 1de63b8d099..0447d4648e4 100644 --- a/src/site/xdoc/checks/imports/avoidstaticimport.xml +++ b/src/site/xdoc/checks/imports/avoidstaticimport.xml @@ -73,7 +73,7 @@ import static java.lang.Math.pow; // violation, 'Using a static member import static java.lang.System.*; // violation, 'Using a static member import should be avoided.' import java.io.File; // OK import java.util.*; // OK - +


    To configure the check so that the java.lang.System.out member and all members from java.lang.Math are allowed: diff --git a/src/site/xdoc/checks/imports/avoidstaticimport.xml.template b/src/site/xdoc/checks/imports/avoidstaticimport.xml.template index 295a18ce58e..7da40238ce1 100644 --- a/src/site/xdoc/checks/imports/avoidstaticimport.xml.template +++ b/src/site/xdoc/checks/imports/avoidstaticimport.xml.template @@ -58,7 +58,7 @@ - +


    To configure the check so that the java.lang.System.out member and all members from java.lang.Math are allowed: diff --git a/src/site/xdoc/checks/imports/customimportorder.xml b/src/site/xdoc/checks/imports/customimportorder.xml index d1c85df8ac9..53a68cfc7ac 100644 --- a/src/site/xdoc/checks/imports/customimportorder.xml +++ b/src/site/xdoc/checks/imports/customimportorder.xml @@ -194,7 +194,7 @@ import java.time.*; import static java.io.File.separator; import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; - +


    To configure the check so that it checks in the order (static imports,standard java packages,third party package): @@ -223,7 +223,7 @@ import static java.io.File.separator; // violation, 'wrong order' import org.apache.commons.io.FileUtils; import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; - +


    To configure the check such that only java packages are included in standard java packages

    @@ -253,7 +253,7 @@ import javax.net.*; // violation, 'should be separated' import org.apache.commons.io.FileUtils; // violation, 'Extra separation' import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; - +

    To configure the check to include only "com" packages as third party group imports: @@ -284,7 +284,7 @@ import javax.net.*; import org.apache.commons.io.FileUtils; // violation, 'should be placed at the end' import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; // violation, 'should be separated' import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; - +


    To configure the check to force some packages in special import group:

    @@ -314,7 +314,7 @@ import java.time.*; import javax.net.*; import org.apache.commons.io.FileUtils; // violation, 'wrong order' - +

    To configure the check such that empty line separator between two groups is enabled:

    @@ -345,7 +345,7 @@ import javax.net.*; import org.apache.commons.io.FileUtils; // violation, 'should be separated' import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; // violation, 'should be separated' import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; - +

    To configure the check such that import groups are forced to be sorted alphabetically:

    @@ -386,7 +386,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; then "org" and then all other imports
  • imports will be sorted in the groups
  • groups are separated by single blank line
  • - +

    Notes:

    • "com" package is not mentioned on configuration, because it is @@ -422,7 +422,7 @@ import org.apache.commons.io.FileUtils; // violation, 'should be separated' import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; - +

      To configure the check so that it matches default Eclipse formatter configuration (tested on Mars release):

      @@ -472,8 +472,7 @@ import org.apache.commons.io.FileUtils; "java", then "javax" and "java"
    • imports will be sorted in the groups
    • groups are separated by one blank line
    • -
    - +

    Note: "separated" option is disabled because IDEA default has blank line between "java" and static imports, and no blank line between @@ -511,7 +510,7 @@ import org.apache.commons.io.FileUtils; // violation, should be in THIRD PARTY P import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; // violation, 'wrong order' import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; // violation, 'wrong order' - +


    To configure the check so that it matches default NetBeans formatter configuration (tested on v8):

    @@ -542,7 +541,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; import org.apache.commons.io.FileUtils; // violation, 'Extra separation' - +

    To set RegExps for THIRD_PARTY_PACKAGE and STANDARD_JAVA_PACKAGE groups use thirdPartyPackageRegExp and standardPackageRegExp options. @@ -574,7 +573,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; import org.apache.commons.io.FileUtils; - +


    Also, this check can be configured to force empty line separator between import groups. For example. @@ -601,7 +600,7 @@ import javax.net.*; import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; import com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck; import org.apache.commons.io.FileUtils; - +


    It is possible to enforce ASCII sort order @@ -643,7 +642,7 @@ import static java.util.Collections.emptyList; import com.google.common.annotations.GwtCompatible; // violation, 'wrong order' import java.lang.String; - +


    configure as follows:

    diff --git a/src/site/xdoc/checks/imports/customimportorder.xml.template b/src/site/xdoc/checks/imports/customimportorder.xml.template index 84fbb00abb7..ee66da3f03d 100644 --- a/src/site/xdoc/checks/imports/customimportorder.xml.template +++ b/src/site/xdoc/checks/imports/customimportorder.xml.template @@ -141,7 +141,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +

    To configure the check so that it checks in the order (static imports,standard java packages,third party package): @@ -158,7 +158,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +


    To configure the check such that only java packages are included in standard java packages

    @@ -174,7 +174,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +

    To configure the check to include only "com" packages as third party group imports: @@ -191,7 +191,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +


    To configure the check to force some packages in special import group:

    @@ -207,7 +207,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +

    To configure the check such that empty line separator between two groups is enabled:

    @@ -223,7 +223,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +

    To configure the check such that import groups are forced to be sorted alphabetically:

    @@ -248,7 +248,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; then "org" and then all other imports
  • imports will be sorted in the groups
  • groups are separated by single blank line
  • - +

    Notes:

    • "com" package is not mentioned on configuration, because it is @@ -268,7 +268,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +

      To configure the check so that it matches default Eclipse formatter configuration (tested on Mars release):

      @@ -300,8 +300,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; "java", then "javax" and "java"
    • imports will be sorted in the groups
    • groups are separated by one blank line
    • -
    - +

    Note: "separated" option is disabled because IDEA default has blank line between "java" and static imports, and no blank line between @@ -320,7 +319,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +


    To configure the check so that it matches default NetBeans formatter configuration (tested on v8):

    @@ -342,7 +341,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +

    To set RegExps for THIRD_PARTY_PACKAGE and STANDARD_JAVA_PACKAGE groups use thirdPartyPackageRegExp and standardPackageRegExp options. @@ -359,7 +358,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +


    Also, this check can be configured to force empty line separator between import groups. For example. @@ -376,7 +375,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +


    It is possible to enforce ASCII sort order @@ -402,7 +401,7 @@ import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; - +


    configure as follows:

    diff --git a/src/site/xdoc/checks/imports/illegalimport.xml b/src/site/xdoc/checks/imports/illegalimport.xml index 7b3c226bbeb..747804491c6 100644 --- a/src/site/xdoc/checks/imports/illegalimport.xml +++ b/src/site/xdoc/checks/imports/illegalimport.xml @@ -85,8 +85,7 @@ import java.util.Date; import sun.applet.*; // violation, 'Illegal import' public class Example1 {} - - +

    To configure the check so that it rejects packages java.io.* and java.sql.*: @@ -118,8 +117,7 @@ import java.util.Date; import sun.applet.*; public class Example2 {} - - +


    To configure the check so that it rejects classes java.util.Date and java.sql.Connection: @@ -152,8 +150,7 @@ import java.util.Date; // violation, 'Illegal import' import sun.applet.*; // violation, 'Illegal import' public class Example3 {} - - +


    To configure the check so that it rejects packages not satisfying to regular expression java\.util: @@ -191,8 +188,7 @@ import java.util.Date; // violation, 'Illegal import' import sun.applet.*; public class Example4 {} - - +


    To configure the check so that it rejects class names not satisfying to regular expression ^java\.util\.(List|Arrays) and diff --git a/src/site/xdoc/checks/imports/illegalimport.xml.template b/src/site/xdoc/checks/imports/illegalimport.xml.template index fd35d613ea7..72049c2e4ff 100644 --- a/src/site/xdoc/checks/imports/illegalimport.xml.template +++ b/src/site/xdoc/checks/imports/illegalimport.xml.template @@ -50,8 +50,7 @@ - - +


    To configure the check so that it rejects packages java.io.* and java.sql.*: @@ -72,8 +71,7 @@ - - +


    To configure the check so that it rejects classes java.util.Date and java.sql.Connection: @@ -94,8 +92,7 @@ - - +


    To configure the check so that it rejects packages not satisfying to regular expression java\.util: @@ -121,8 +118,7 @@ - - +


    To configure the check so that it rejects class names not satisfying to regular expression ^java\.util\.(List|Arrays) and diff --git a/src/site/xdoc/checks/imports/importorder.xml b/src/site/xdoc/checks/imports/importorder.xml index 175dae566d6..3a858dc69f8 100644 --- a/src/site/xdoc/checks/imports/importorder.xml +++ b/src/site/xdoc/checks/imports/importorder.xml @@ -149,7 +149,7 @@ import com.neurologic.http.impl.ApacheHttpClient; then "org" and then all other imports

  • imports will be sorted in the groups
  • groups are separated by, at least, one blank line and aren't separated internally
  • - +

    Notes:

    • "com" package is not mentioned on configuration, because it is @@ -186,7 +186,7 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; // violation, groups should not be separated internally import org.apache.http.conn.ClientConnectionManager; - +

      To configure the check so that it matches default Eclipse formatter configuration (tested on Mars release): @@ -252,7 +252,7 @@ import com.neurologic.http.impl.ApacheHttpClient; ImportOrder has a limitation by design to enforce an empty line between groups ("java", "javax"). There is no flexibility to enforce empty lines between some groups and no empty lines between other groups. -

      +


      Note: "separated" option is disabled because IDEA default has blank line between "java" and static imports, and no blank line between "javax" and "java". @@ -287,7 +287,7 @@ import java.net.URL; // violation, extra separation in import group import java.security.KeyManagementException; import javax.swing.JComponent; // violation, wrong order, 'javax' should be above 'java' imports import com.neurologic.http.HttpClient; // violation, wrong order, 'com' imports should be at top - +


      To configure the check so that it matches default NetBeans formatter configuration (tested on v8): @@ -337,7 +337,7 @@ import static javax.windowConstants.*; not, default value is false. It is applied to static imports grouped with top or bottom options. This option is helping in reconciling of this Check and other tools like Eclipse's Organize Imports feature. -

      +


      To configure the Check allows static imports grouped to the top being sorted alphabetically: @@ -364,8 +364,7 @@ import static org.abego.treelayout.Configuration.AlignmentInLevel; // OK, alphab import java.util.Set; // violation, extra separation in import group import static java.lang.Math.abs; // violation, wrong order, all static imports comes at 'top' import org.abego.*; - - +


      To configure the Check with groups of static imports:

      @@ -410,7 +409,7 @@ import static HttpHeaders.Names.DATE => HttpHeaders.Names

      According to this logic, HttpHeaders.Names should come after HttpHeaders. -

      +


      Example for useContainerOrderingForStatic=true

      @@ -435,7 +434,7 @@ import static io.netty.handler.codec.http.HttpConstants.COLON; import static io.netty.handler.codec.http.HttpHeaders.addHeader; import static io.netty.handler.codec.http.HttpHeaders.setHeader; import static io.netty.handler.codec.http.HttpHeaders.Names.DATE; - +

      Example for useContainerOrderingForStatic=false

      @@ -465,7 +464,7 @@ public class Example9 { }

      To configure the check to enforce static import group separation -

      +


      Example for separatedStaticGroups=true

      @@ -490,7 +489,7 @@ import static javax.swing.JComponent; // violation, should be separated from pre import static javax.WindowConstants.*; import java.net.URL; - +

      To configure the Check with groups of static imports when staticGroups="" represents all imports as {@code everything else} group: @@ -513,7 +512,7 @@ import static java.io.File.listRoots; import static javax.swing.WindowConstants.*; import static java.io.File.createTempFile; import static com.puppycrawl.tools.checkstyle; - +


      To configure the Check with groups of static imports when staticGroups="java, javax" represents three groups i.e java*, javax* diff --git a/src/site/xdoc/checks/imports/importorder.xml.template b/src/site/xdoc/checks/imports/importorder.xml.template index 06659fbb68c..00fa2948f02 100644 --- a/src/site/xdoc/checks/imports/importorder.xml.template +++ b/src/site/xdoc/checks/imports/importorder.xml.template @@ -69,7 +69,7 @@ then "org" and then all other imports

    • imports will be sorted in the groups
    • groups are separated by, at least, one blank line and aren't separated internally
    • -
    +

    Notes:

    In addition to Java files, there are similar limitations that apply to all @@ -724,7 +730,6 @@ public class MethodLimitCheck extends AbstractCheck - a Check that validate that user custom Exception class inherited from java.lang.Exception class.

    -
    diff --git a/src/site/xdoc/writingjavadocchecks.xml.vm b/src/site/xdoc/writingjavadocchecks.xml.vm index 693c5acd0e6..8edd778f92f 100644 --- a/src/site/xdoc/writingjavadocchecks.xml.vm +++ b/src/site/xdoc/writingjavadocchecks.xml.vm @@ -196,15 +196,6 @@ public class MyClass { as block comments, whether they are Javadocs or not. Our Javadoc parser then transforms these block comment ASTs into our Javadoc AST.

    -

    - The difference is that Java grammar uses ANTLR v2, while Javadoc grammar uses ANTLR v4. - Because of that, these two grammars and their trees are not compatible. - Java AST consists of - DetailAST - objects, while Javadoc AST consists of - DetailNode - objects. -

    Our Java grammar ignores whitespace in most cases, since Java itself does not care about whitespace; however, whitespace is critical in Javadocs. For this reason, our Javadoc AST diff --git a/src/site/xdoc/writinglisteners.xml.vm b/src/site/xdoc/writinglisteners.xml.vm index 9e63731db1f..8aaf945b552 100644 --- a/src/site/xdoc/writinglisteners.xml.vm +++ b/src/site/xdoc/writinglisteners.xml.vm @@ -9,6 +9,12 @@ +

    + + + + +

    diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java index ac7c7ef1088..048346ff53a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java @@ -69,7 +69,7 @@ public class MainTest { private static final String SHORT_USAGE = String.format(Locale.ROOT, - "Usage: checkstyle [OPTIONS]... FILES...%n" + "Usage: checkstyle [OPTIONS]... file(s) or folder(s) ...%n" + "Try 'checkstyle --help' for more information.%n"); private static final String USAGE = String.format(Locale.ROOT, @@ -78,13 +78,13 @@ public class MainTest { + " [-o=] [-p=] " + "[-s=]%n" + " [-w=] [-e=]... [-x=]... " - + "...%n" + + "...%n" + "Checkstyle verifies that the specified source code files adhere to the" + " specified rules. By default,%n" + "violations are reported to standard out in plain format. Checkstyle requires" + " a configuration XML%n" + "file that configures the checks to apply.%n" - + " ... One or more source files to verify%n" + + " ... One or more source files to verify%n" + " -b, --branch-matching-xpath=%n" + " Shows Abstract Syntax Tree(AST) branches that" + " match given XPath query.%n" @@ -292,7 +292,7 @@ public void testWrongArgumentMissingFiles(@SysErr Capturable systemErr, assertMainReturnCode(-1, "-q"); // files is defined as a required positional param; // picocli verifies required parameters before checking unknown options - final String usage = "Missing required parameter: ''" + EOL + SHORT_USAGE; + final String usage = "Missing required parameter: ''" + EOL + SHORT_USAGE; assertWithMessage("Unexpected output log") .that(systemOut.getCapturedData()) .isEqualTo(""); @@ -1763,7 +1763,7 @@ public void testNoProblemOnExecuteIgnoredModuleWithBadPropertyValue( @Test public void testMissingFiles(@SysErr Capturable systemErr, @SysOut Capturable systemOut) { assertMainReturnCode(-1); - final String usage = "Missing required parameter: ''" + EOL + SHORT_USAGE; + final String usage = "Missing required parameter: ''" + EOL + SHORT_USAGE; assertWithMessage("Unexpected output log") .that(systemOut.getCapturedData()) .isEqualTo(""); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/SarifLoggerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/SarifLoggerTest.java index 4abc4b6dca5..f4e046c1886 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/SarifLoggerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/SarifLoggerTest.java @@ -124,16 +124,14 @@ public void testAddErrorAtColumn1() throws IOException { } @Test - public void testAddErrorAtColumn0() throws IOException { + public void testAddErrorAtColumn0() throws Exception { + final String inputFile = "InputSarifLoggerErrorColumn0.java"; + final String expectedReportFile = "ExpectedSarifLoggerSingleErrorColumn0.sarif"; final SarifLogger logger = new SarifLogger(outStream, OutputStreamOptions.CLOSE); - logger.auditStarted(null); - final Violation violation = - new Violation(1, 0, - "messages.properties", "ruleId", null, SeverityLevel.ERROR, null, - getClass(), "found an error\nplease try again"); - executeLogger(this, logger, "Test.java", violation); - verifyContent(getPath("ExpectedSarifLoggerSingleErrorColumn0.sarif"), outStream); + + verifyWithInlineConfigParserAndLogger( + getPath(inputFile), getPath(expectedReportFile), logger, outStream); } @Test diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java index 9929794f746..8b2936de35c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTaskTest.java @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertWithMessage; import static com.puppycrawl.tools.checkstyle.internal.utils.TestUtil.getExpectedThrowable; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import java.io.File; import java.io.IOException; @@ -317,9 +318,12 @@ public final void testNonExistentConfig() throws IOException { final BuildException ex = getExpectedThrowable(BuildException.class, antTask::execute, "BuildException is expected"); + // Verify exact format of error message (testing String.format mutation) + final String expectedExceptionFormat = String.format(Locale.ROOT, + "Unable to create Root Module: config {%s}.", getPath(NOT_EXISTING_FILE)); assertWithMessage("Error message is unexpected") .that(ex.getMessage()) - .startsWith("Unable to create Root Module: config"); + .isEqualTo(expectedExceptionFormat); } @Test @@ -331,9 +335,12 @@ public final void testEmptyConfigFile() throws IOException { final BuildException ex = getExpectedThrowable(BuildException.class, antTask::execute, "BuildException is expected"); + final String expectedMessage = String.format(Locale.ROOT, + "Unable to create Root Module: config {%s}.", + getPath("InputCheckstyleAntTaskEmptyConfig.xml")); assertWithMessage("Error message is unexpected") .that(ex.getMessage()) - .startsWith("Unable to create Root Module: config"); + .isEqualTo(expectedMessage); } @Test @@ -352,12 +359,18 @@ public final void testMaxWarningExceeded() throws IOException { final CheckstyleAntTask antTask = getCheckstyleAntTask(); antTask.setFile(new File(getPath(WARNING_INPUT))); antTask.setMaxWarnings(0); + final Location fileLocation = new Location("build.xml", 42, 10); + antTask.setLocation(fileLocation); + final BuildException ex = getExpectedThrowable(BuildException.class, antTask::execute, "BuildException is expected"); assertWithMessage("Error message is unexpected") .that(ex.getMessage()) .isEqualTo("Got 0 errors (max allowed: 0) and 1 warnings."); + assertWithMessage("Location is missing in exception") + .that(ex.getLocation()) + .isEqualTo(fileLocation); } @Test @@ -649,7 +662,8 @@ public final void testCreateListenerException() throws IOException { "BuildException is expected"); assertWithMessage("Error message is unexpected") .that(ex.getMessage()) - .startsWith("Unable to create listeners: formatters"); + .isEqualTo("Unable to create listeners: formatters " + + "{" + List.of(formatter) + "}."); } @Test @@ -965,4 +979,15 @@ private static long getNumberFromLine(String line) { return Long.parseLong(matcher.group(1)); } + @Test + public void testMaxWarningDefault() throws IOException { + final CheckstyleAntTask antTask = getCheckstyleAntTask(); + final File inputFile = new File(getPath(WARNING_INPUT)); + final Location fileLocation = new Location("build.xml", 42, 10); + + antTask.setFile(inputFile); + antTask.setLocation(fileLocation); + assertDoesNotThrow(antTask::execute, "BuildException is not expected"); + } + } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java b/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java index 1182c2e54aa..04f6ecc8cc3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java @@ -217,7 +217,6 @@ public final class InlineConfigParser { */ private static final Set SUPPRESSED_CHECKS = Set.of( "com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck", - "com.puppycrawl.tools.checkstyle.checks.coding.CovariantEqualsCheck", "com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck", "com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiationCheck", "com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck", @@ -269,11 +268,9 @@ public final class InlineConfigParser { "com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck", "com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck", - "com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck", "com.puppycrawl.tools.checkstyle.checks.naming.IllegalIdentifierNameCheck", "com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck", "com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterNameCheck", - "com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck", "com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck", "com.puppycrawl.tools.checkstyle.checks.naming.PatternVariableNameCheck", "com.puppycrawl.tools.checkstyle.checks.naming.RecordComponentNameCheck", diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java index 855ce90a0f7..f6cb5a4eb14 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertWithMessage; import static com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck.MSG_UNUSED_LOCAL_VARIABLE; +import static com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck.MSG_KEY; import java.io.File; import java.lang.reflect.Constructor; @@ -44,6 +45,8 @@ import com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck; import com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck; +import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; import com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck; import com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck; import com.puppycrawl.tools.checkstyle.checks.whitespace.TypecastParenPadCheck; @@ -517,6 +520,83 @@ public void testAliasList2() throws Exception { expected); } + @Test + public void testAliasList3() throws Exception { + final String[] expected = { + "16:17: " + getCheckMessage(ParameterNumberCheck.class, + ParameterNumberCheck.MSG_KEY, 7, 8), + "28:17: " + getCheckMessage(ParameterNumberCheck.class, + ParameterNumberCheck.MSG_KEY, 7, 8), + }; + + verifyWithInlineConfigParser( + getPath("InputSuppressWarningsHolderAlias5.java"), + expected); + } + + @Test + public void testAliasList4() throws Exception { + final String pattern = "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"; + final String[] expected = { + "16:30: " + getCheckMessage(ConstantNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "a", pattern), + "19:30: " + getCheckMessage(ConstantNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "b", pattern), + }; + + verifyWithInlineConfigParser( + getPath("InputSuppressWarningsHolderAlias4.java"), + expected); + } + + @Test + public void testAliasList5() throws Exception { + final String[] expected = { + "18: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 80, 83), + "28: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 75, 96), + "28: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 80, 96), + "58: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 75, 76), + "65: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 75, 87), + }; + + verifyWithInlineConfigParser( + getPath("InputSuppressWarningsHolderAlias6.java"), + expected); + } + + @Test + public void testAliasList6() throws Exception { + final String pattern1 = "^[a-z][a-zA-Z0-9]*$"; + final String pattern2 = "^[A-Z][a-zA-Z0-9]*$"; + + final String[] expected = { + "25:18: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "Method3", pattern1), + "30:20: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "Method5", pattern1), + "35:17: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "method7", pattern2), + "40:18: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "method9", pattern2), + "45:20: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "method11", pattern2), + "47:17: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "_methodCheck1", pattern2), + "53:18: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "_methodCheck3", pattern2), + "53:18: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "_methodCheck3", pattern1), + "61:20: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "_methodCheck5", pattern2), + "61:20: " + getCheckMessage(MethodNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "_methodCheck5", pattern1), + }; + + verifyWithInlineConfigParser( + getPath("InputSuppressWarningsHolderAlias7.java"), + expected); + } + @Test public void testIdent() throws Exception { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java index 5a16265e97e..bef86515b32 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java @@ -350,7 +350,39 @@ public void testAnnotationClosingParenthesisEndsInSameIndentationAsOpening() thr } @Test - public void testAnonClassesFromGuava() throws Exception { + public void testAnnotationsFromGuava() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, getPath("InputIndentationFromGuava.java"), expected); + } + + @Test + public void testAnnotationsFromGuava1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, getPath("InputIndentationFromGuava1.java"), expected); + } + + @Test + public void testAnnotationsFromGuava2() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); @@ -366,7 +398,7 @@ public void testAnonClassesFromGuava() throws Exception { } @Test - public void testAnnotations() throws Exception { + public void testAnnotationsFromGuava3() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); @@ -378,7 +410,23 @@ public void testAnnotations() throws Exception { checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("throwsIndent", "4"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verifyWarns(checkConfig, getPath("InputIndentationFromGuava.java"), expected); + verifyWarns(checkConfig, getPath("InputIndentationFromGuava3.java"), expected); + } + + @Test + public void testAnnotationsFromGuava4() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, getPath("InputIndentationFromGuava4.java"), expected); } @Test @@ -394,16 +442,33 @@ public void testCorrectIfAndParameters() throws Exception { checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("throwsIndent", "4"); final String[] expected = { - "33:9: " + getCheckMessage(MSG_ERROR_MULTI, "new", 8, "10, 12"), - "40:9: " + getCheckMessage(MSG_ERROR_MULTI, "new", 8, "10, 12"), - "90:11: " + getCheckMessage(MSG_ERROR_MULTI, "new", 10, "12, 14"), - "97:13: " + getCheckMessage(MSG_ERROR_MULTI, "new", 12, "14, 16"), - "119:13: " + getCheckMessage(MSG_ERROR_MULTI, "new", 12, "14, 16"), - "126:15: " + getCheckMessage(MSG_ERROR_MULTI, "new", 14, "16, 18"), + "65:11: " + getCheckMessage(MSG_ERROR_MULTI, "new", 10, "12, 14"), + "72:13: " + getCheckMessage(MSG_ERROR_MULTI, "new", 12, "14, 16"), + "94:13: " + getCheckMessage(MSG_ERROR_MULTI, "new", 12, "14, 16"), + "101:15: " + getCheckMessage(MSG_ERROR_MULTI, "new", 14, "16, 18"), }; verifyWarns(checkConfig, getPath("InputIndentationCorrectIfAndParameter.java"), expected); } + @Test + public void testCorrectIfAndParameters1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String[] expected = { + "38:9: " + getCheckMessage(MSG_ERROR_MULTI, "new", 8, "10, 12"), + "45:9: " + getCheckMessage(MSG_ERROR_MULTI, "new", 8, "10, 12"), + }; + verifyWarns(checkConfig, getPath("InputIndentationCorrectIfAndParameter1.java"), expected); + } + @Test public void testAnonymousClasses() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -452,6 +517,22 @@ public void testLabels() throws Exception { verifyWarns(checkConfig, getPath("InputIndentationLabels.java"), expected); } + @Test + public void testLabels1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, getPath("InputIndentationLabels1.java"), expected); + } + @Test public void testClassesAndMethods() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -501,6 +582,18 @@ public void testCtorCall() throws Exception { verifyWarns(checkConfig, getPath("InputIndentationCtorCall.java"), expected); } + @Test + public void testCtorCall1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, getPath("InputIndentationCtorCall1.java"), expected); + } + @Test public void testMembers() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -787,11 +880,45 @@ public void testValidIfWithChecker() throws Exception { checkConfig.addProperty("throwsIndent", "4"); final String fileName = getPath("InputIndentationValidIfIndent.java"); final String[] expected = { - "231:9: " + getCheckMessage(MSG_ERROR, "(", 8, 12), + "95:9: " + getCheckMessage(MSG_ERROR, "(", 8, 12), }; verifyWarns(checkConfig, fileName, expected); } + @Test + public void testValidIfWithChecker1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationValidIfIndent1.java"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testValidIfWithChecker2() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationValidIfIndent2.java"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, fileName, expected); + } + @Test public void testValidDotWithChecker() throws Exception { @@ -825,14 +952,14 @@ public void testValidMethodWithChecker() checkConfig.addProperty("throwsIndent", "4"); final String fileName = getPath("InputIndentationValidMethodIndent.java"); final String[] expected = { - "129:5: " + getCheckMessage(MSG_ERROR, "void", 4, 8), - "130:5: " + getCheckMessage(MSG_ERROR, "method5", 4, 8), + "76:5: " + getCheckMessage(MSG_ERROR, "void", 4, 8), + "77:5: " + getCheckMessage(MSG_ERROR, "method5", 4, 8), }; verifyWarns(checkConfig, fileName, expected); } @Test - public void testInvalidMethodWithChecker() + public void testValidMethodWithChecker1() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -844,7 +971,25 @@ public void testInvalidMethodWithChecker() checkConfig.addProperty("lineWrappingIndentation", "4"); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("throwsIndent", "4"); - final String fileName = getPath("InputIndentationInvalidMethodIndent.java"); + final String fileName = getPath("InputIndentationValidMethodIndent1.java"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidMethodWithChecker1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidMethodIndent1.java"); final String[] expected = { "23:7: " + getCheckMessage(MSG_ERROR, "ctor def rcurly", 6, 4), "26:7: " + getCheckMessage(MSG_ERROR, "ctor def modifier", 6, 4), @@ -856,31 +1001,50 @@ public void testInvalidMethodWithChecker() "70:6: " + getCheckMessage(MSG_ERROR, "final", 5, 9), "71:6: " + getCheckMessage(MSG_ERROR, "void", 5, 9), "72:5: " + getCheckMessage(MSG_ERROR, "method5", 4, 9), - "80:4: " + getCheckMessage(MSG_ERROR, "method def modifier", 3, 4), - "81:4: " + getCheckMessage(MSG_ERROR, "final", 3, 7), - "82:4: " + getCheckMessage(MSG_ERROR, "void", 3, 7), - "83:6: " + getCheckMessage(MSG_ERROR, "method6", 5, 7), - "93:5: " + getCheckMessage(MSG_CHILD_ERROR, "ctor def", 4, 8), - "98:7: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 6, 8), - "99:7: " + getCheckMessage(MSG_ERROR, "if", 6, 8), - "100:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "101:7: " + getCheckMessage(MSG_ERROR, "if rcurly", 6, 8), - "104:11: " + getCheckMessage(MSG_ERROR, "Arrays", 10, 12), - "110:15: " + getCheckMessage(MSG_ERROR, "new", 14, 16), - "113:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), - "118:15: " + getCheckMessage(MSG_ERROR, "new", 14, 16), - "122:11: " + getCheckMessage(MSG_ERROR, "new", 10, 12), - "126:11: " + getCheckMessage(MSG_ERROR, "new", 10, 12), - "127:7: " + getCheckMessage(MSG_ERROR, ")", 6, 8), - "131:7: " + getCheckMessage(MSG_ERROR, "method call rparen", 6, 8), - "145:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), - "148:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), - "158:7: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 6, 12), - "170:5: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 4, 8), - "175:5: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 4, 8), - "179:1: " + getCheckMessage(MSG_ERROR, "int", 0, 8), - "180:5: " + getCheckMessage(MSG_ERROR, "method9", 4, 8), - "190:13: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 12, 8), + "86:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), + "89:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), + "99:7: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 6, 12), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidMethodWithChecker2() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidMethodIndent2.java"); + final String[] expected = { + "23:5: " + getCheckMessage(MSG_CHILD_ERROR, "ctor def", 4, 8), + "26:4: " + getCheckMessage(MSG_ERROR, "method def modifier", 3, 4), + "27:4: " + getCheckMessage(MSG_ERROR, "final", 3, 7), + "28:4: " + getCheckMessage(MSG_ERROR, "void", 3, 7), + "29:6: " + getCheckMessage(MSG_ERROR, "method6", 5, 7), + "39:7: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 6, 8), + "40:7: " + getCheckMessage(MSG_ERROR, "if", 6, 8), + "41:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), + "42:7: " + getCheckMessage(MSG_ERROR, "if rcurly", 6, 8), + "45:11: " + getCheckMessage(MSG_ERROR, "Arrays", 10, 12), + "51:15: " + getCheckMessage(MSG_ERROR, "new", 14, 16), + "54:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), + "59:15: " + getCheckMessage(MSG_ERROR, "new", 14, 16), + "63:11: " + getCheckMessage(MSG_ERROR, "new", 10, 12), + "67:11: " + getCheckMessage(MSG_ERROR, "new", 10, 12), + "68:7: " + getCheckMessage(MSG_ERROR, ")", 6, 8), + "72:7: " + getCheckMessage(MSG_ERROR, "method call rparen", 6, 8), + "86:5: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 4, 8), + "91:5: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 4, 8), + "95:1: " + getCheckMessage(MSG_ERROR, "int", 0, 8), + "96:5: " + getCheckMessage(MSG_ERROR, "method9", 4, 8), + "106:13: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 12, 8), }; verifyWarns(checkConfig, fileName, expected); } @@ -1260,70 +1424,6 @@ public void testValidArrayInit() verifyWarns(checkConfig, fileName, expected); } - @Test - public void testInvalidArrayInitWithChecker() - throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); - - checkConfig.addProperty("arrayInitIndent", "4"); - checkConfig.addProperty("basicOffset", "4"); - checkConfig.addProperty("braceAdjustment", "0"); - checkConfig.addProperty("caseIndent", "4"); - checkConfig.addProperty("forceStrictCondition", "false"); - checkConfig.addProperty("lineWrappingIndentation", "4"); - checkConfig.addProperty("tabWidth", "4"); - checkConfig.addProperty("throwsIndent", "4"); - final String fileName = getPath("InputIndentationInvalidArrayInitIndent.java"); - final String[] expected = { - "21:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), - "22:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), - "24:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), - "28:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), - "29:9: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 8, 10), - "30:5: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 4, "6, 10"), - "33:10: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 9, 8), - "34:8: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 7, 8), - "35:10: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 9, 8), - "40:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 2, "4, 8"), - "44:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "4, 8"), - "48:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 2, "4, 8"), - "52:21: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 20, - "8, 31, 33"), - "53:5: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", - 4, "8, 31, 33"), - "58:7: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 6, 8), - "63:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), - "65:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), - "66:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 2, "6, 10"), - "69:7: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 6, 8), - "76:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "89:9: " + getCheckMessage(MSG_ERROR, "1", 8, 12), - "100:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "101:15: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 14, 12), - "104:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "105:15: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 14, 12), - "106:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), - "109:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 6, "8, 12"), - "110:15: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 14, 12), - "111:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "112:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), - // following are tests for annotation array initialization - "120:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", - 12, "16, 46, 48"), - "124:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", - 14, "12, 16"), - "128:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", - 14, "16, 28, 30"), - "129:9: " + getCheckMessage(MSG_ERROR_MULTI, "annotation array initialization rcurly", - 8, "12, 16"), - "131:13: " + getCheckMessage(MSG_CHILD_ERROR, "annotation array initialization", - 12, 16), - }; - - // Test input for this test case is not checked due to issue #693. - verify(checkConfig, fileName, expected); - } - @Test public void testArrayInitWithEmoji() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -1410,11 +1510,15 @@ public void testInvalidArrayInitWithTrueStrictCondition() "22:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), "24:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), "28:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), - "29:9: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 8, 10), + "29:9: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 8, + "10, 34, 36"), "30:5: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 4, "6, 10"), - "33:10: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 9, 8), - "34:8: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 7, 8), - "35:10: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 9, 8), + "33:10: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 9, + "8, 31, 33"), + "34:8: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 7, + "8, 31, 33"), + "35:10: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 9, + "8, 31, 33"), "40:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 2, "4, 8"), "44:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "4, 8"), "48:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 2, "4, 8"), @@ -1422,36 +1526,214 @@ public void testInvalidArrayInitWithTrueStrictCondition() "8, 31, 33"), "53:5: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 4, "8, 31, 33"), - "58:7: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 6, 8), + "58:7: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 6, "8, 31, 33"), "63:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), "65:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), "66:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 2, "6, 10"), - "69:7: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 6, 8), - "76:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "89:9: " + getCheckMessage(MSG_ERROR, "1", 8, 12), - "100:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "101:15: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 14, 12), - "104:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "105:15: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 14, 12), - "106:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), - "109:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 6, "8, 12"), - "110:15: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 14, 12), - "111:11: " + getCheckMessage(MSG_CHILD_ERROR, "array initialization", 10, 12), - "112:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), + "69:7: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 6, "8, 36, 38"), + "76:11: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 10, "12, 24, 26"), + }; + + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidArrayInitWithTrueStrictCondition1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "true"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidArrayInitIndent1.java"); + final String[] expected = { + "28:9: " + getCheckMessage(MSG_ERROR, "1", 8, 12), + "39:11: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 10, + "12, 30, 32"), + "40:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 14, + "12, 30, 32"), + "43:11: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 10, + "12, 31, 32"), + "44:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 14, + "12, 31, 32"), + "45:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), + "48:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 6, "8, 12"), + "49:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 14, + "8, 10, 12"), + "51:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), // following are tests for annotation array initialization - "120:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + "59:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", 12, "16, 46, 48"), - "124:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + "67:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 14, "16, 28, 30"), + "68:9: " + getCheckMessage(MSG_ERROR_MULTI, "annotation array initialization rcurly", + 8, "12, 16"), + "70:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 12, "16, 29, 31"), + }; + + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidArrayInitWithFalseStrictCondition() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidArrayInitIndent.java"); + final String[] expected = { + "21:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), + "22:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), + "24:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), + "28:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), + "29:9: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 8, + "10, 34, 36"), + "30:5: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 4, "6, 10"), + "33:10: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 9, + "8, 31, 33"), + "34:8: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 7, + "8, 31, 33"), + "35:10: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 9, + "8, 31, 33"), + "40:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 2, "4, 8"), + "44:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "4, 8"), + "48:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 2, "4, 8"), + "52:21: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 20, + "8, 31, 33"), + "53:5: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 4, "8, 31, 33"), + "58:7: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 6, "8, 31, 33"), + "63:3: " + getCheckMessage(MSG_ERROR, "member def type", 2, 4), + "65:7: " + getCheckMessage(MSG_ERROR, "member def type", 6, 4), + "66:3: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 2, "6, 10"), + "69:7: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 6, "8, 36, 38"), + "76:11: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", + 10, "12, 24, 26"), + }; + + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidArrayInitWithFalseStrictCondition1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidArrayInitIndent1.java"); + final String[] expected = { + "28:9: " + getCheckMessage(MSG_ERROR, "1", 8, 12), + "39:11: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 10, + "12, 30, 32"), + "40:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 14, + "12, 30, 32"), + "43:11: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 10, + "12, 31, 32"), + "44:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 14, + "12, 31, 32"), + "45:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), + "48:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization lcurly", 6, "8, 12"), + "49:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "array initialization", 14, + "8, 10, 12"), + "51:7: " + getCheckMessage(MSG_ERROR_MULTI, "array initialization rcurly", 6, "8, 12"), + // following are tests for annotation array initialization + "59:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 12, "16, 46, 48"), + "67:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 14, "16, 28, 30"), + "68:9: " + getCheckMessage(MSG_ERROR_MULTI, "annotation array initialization rcurly", + 8, "12, 16"), + "70:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 12, "16, 29, 31"), + }; + + verifyWarns(checkConfig, fileName, expected); + } + + // Test Input without trailing comment and usage of 'verify' method is due to #16906 + @Test + public void testInvalidArrayInitIndentNoCommentsTrueStrictCondition() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "true"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath( + "InputIndentationInvalidArrayInitIndentWithoutTrailingComments.java"); + final String[] expected = { + "28:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 12, "16, 46, 48"), + "32:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", 14, "12, 16"), - "128:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + "36:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", 14, "16, 28, 30"), - "129:9: " + getCheckMessage(MSG_ERROR_MULTI, "annotation array initialization rcurly", + "37:9: " + getCheckMessage(MSG_ERROR_MULTI, "annotation array initialization rcurly", 8, "12, 16"), - "131:13: " + getCheckMessage(MSG_CHILD_ERROR, "annotation array initialization", + "39:13: " + getCheckMessage(MSG_CHILD_ERROR, "annotation array initialization", 12, 16), }; + verify(checkConfig, fileName, expected); + } - // Test input for this test case is not checked due to issue #693. + // Test Input without trailing comment and usage of 'verify' method is due to #16906 + @Test + public void testInvalidArrayInitIndentNoCommentsFalseStrictCondition() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath( + "InputIndentationInvalidArrayInitIndentWithoutTrailingComments.java"); + final String[] expected = { + "28:13: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 12, "16, 46, 48"), + "32:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 14, "12, 16"), + "36:15: " + getCheckMessage(MSG_CHILD_ERROR_MULTI, "annotation array initialization", + 14, "16, 28, 30"), + "37:9: " + getCheckMessage(MSG_ERROR_MULTI, "annotation array initialization rcurly", + 8, "12, 16"), + "39:13: " + getCheckMessage(MSG_CHILD_ERROR, "annotation array initialization", + 12, 16), + }; verify(checkConfig, fileName, expected); } @@ -1534,41 +1816,61 @@ public void testInvalidClassDefWithChecker() checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("throwsIndent", "4"); final String fileName = getPath("InputIndentationInvalidClassDefIndent.java"); + final String[] expected = { + "18:3: " + getCheckMessage(MSG_ERROR, "class def modifier", 2, 0), + "24:3: " + getCheckMessage(MSG_ERROR, "class def lcurly", 2, 0), + "27:3: " + getCheckMessage(MSG_ERROR, "class def rcurly", 2, 0), + "30:9: " + getCheckMessage(MSG_ERROR, "class def ident", 2, 0), + "34:3: " + getCheckMessage(MSG_ERROR, "class def rcurly", 2, 0), + "39:3: " + getCheckMessage(MSG_ERROR, "extends", 2, 4), + "40:3: " + getCheckMessage(MSG_ERROR, "implements", 2, 4), + "46:3: " + getCheckMessage(MSG_ERROR, "extends", 2, 4), + "54:3: " + getCheckMessage(MSG_ERROR, "implements", 2, 4), + "55:3: " + getCheckMessage(MSG_ERROR, "java", 2, 4), + "60:3: " + getCheckMessage(MSG_ERROR, "class def modifier", 2, 0), + "61:3: " + getCheckMessage(MSG_ERROR, "class def lcurly", 2, 0), + "69:3: " + getCheckMessage(MSG_ERROR, "class def rcurly", 2, 0), + "73:3: " + getCheckMessage(MSG_ERROR, "extends", 2, 4), + "79:1: " + getCheckMessage(MSG_ERROR, "class", 0, 4), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidClassDefWithChecker1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidClassDefIndent1.java"); final String[] expected = { "22:3: " + getCheckMessage(MSG_ERROR, "class def modifier", 2, 0), - "28:3: " + getCheckMessage(MSG_ERROR, "class def lcurly", 2, 0), - "31:3: " + getCheckMessage(MSG_ERROR, "class def rcurly", 2, 0), - "34:9: " + getCheckMessage(MSG_ERROR, "class def ident", 2, 0), - "38:3: " + getCheckMessage(MSG_ERROR, "class def rcurly", 2, 0), - "43:3: " + getCheckMessage(MSG_ERROR, "extends", 2, 4), - "44:3: " + getCheckMessage(MSG_ERROR, "implements", 2, 4), - "50:3: " + getCheckMessage(MSG_ERROR, "extends", 2, 4), - "58:3: " + getCheckMessage(MSG_ERROR, "implements", 2, 4), - "59:3: " + getCheckMessage(MSG_ERROR, "java", 2, 4), - "64:3: " + getCheckMessage(MSG_ERROR, "class def modifier", 2, 0), - "65:3: " + getCheckMessage(MSG_ERROR, "class def lcurly", 2, 0), - "73:3: " + getCheckMessage(MSG_ERROR, "class def rcurly", 2, 0), - "77:3: " + getCheckMessage(MSG_ERROR, "extends", 2, 4), - "86:9: " + getCheckMessage(MSG_ERROR, "class def ident", 2, 4), - "88:13: " + getCheckMessage(MSG_ERROR, "class def ident", 6, 4), - "91:9: " + getCheckMessage(MSG_ERROR, "class def ident", 2, 4), - "95:7: " + getCheckMessage(MSG_ERROR, "member def modifier", 6, 8), - "101:11: " + getCheckMessage(MSG_ERROR, "int", 10, 12), - "106:7: " + getCheckMessage(MSG_ERROR, "member def modifier", 6, 8), - "111:7: " + getCheckMessage(MSG_ERROR, "class def rcurly", 6, 4), - "113:13: " + getCheckMessage(MSG_ERROR, "class def ident", 6, 4), - "119:13: " + getCheckMessage(MSG_ERROR, "class def ident", 6, 8), - "122:17: " + getCheckMessage(MSG_ERROR, "class def ident", 10, 8), - "124:11: " + getCheckMessage(MSG_ERROR, "class def rcurly", 10, 8), - "127:11: " + getCheckMessage(MSG_ERROR, "member def type", 10, 12), - "132:11: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 10, 8), - "133:9: " + getCheckMessage(MSG_ERROR_MULTI, "object def lcurly", 8, "10, 14"), - "137:9: " + getCheckMessage(MSG_ERROR_MULTI, "object def rcurly", 8, "10, 14"), - "141:7: " + getCheckMessage(MSG_ERROR_MULTI, "object def lcurly", 6, "8, 12"), - "145:7: " + getCheckMessage(MSG_ERROR_MULTI, "object def rcurly", 6, "8, 12"), - "150:11: " + getCheckMessage(MSG_ERROR, "method def modifier", 10, 12), - "152:11: " + getCheckMessage(MSG_ERROR, "method def rcurly", 10, 12), - "188:1: " + getCheckMessage(MSG_ERROR, "class", 0, 4), + "27:9: " + getCheckMessage(MSG_ERROR, "class def ident", 2, 4), + "29:13: " + getCheckMessage(MSG_ERROR, "class def ident", 6, 4), + "31:9: " + getCheckMessage(MSG_ERROR, "class def ident", 2, 4), + "34:7: " + getCheckMessage(MSG_ERROR, "member def modifier", 6, 8), + "40:11: " + getCheckMessage(MSG_ERROR, "int", 10, 12), + "44:7: " + getCheckMessage(MSG_ERROR, "member def modifier", 6, 8), + "49:7: " + getCheckMessage(MSG_ERROR, "class def rcurly", 6, 4), + "51:13: " + getCheckMessage(MSG_ERROR, "class def ident", 6, 4), + "56:13: " + getCheckMessage(MSG_ERROR, "class def ident", 6, 8), + "59:17: " + getCheckMessage(MSG_ERROR, "class def ident", 10, 8), + "61:11: " + getCheckMessage(MSG_ERROR, "class def rcurly", 10, 8), + "64:11: " + getCheckMessage(MSG_ERROR, "member def type", 10, 12), + "69:11: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 10, 8), + "70:9: " + getCheckMessage(MSG_ERROR_MULTI, "object def lcurly", 8, "10, 14"), + "74:9: " + getCheckMessage(MSG_ERROR_MULTI, "object def rcurly", 8, "10, 14"), + "77:7: " + getCheckMessage(MSG_ERROR_MULTI, "object def lcurly", 6, "8, 12"), + "81:7: " + getCheckMessage(MSG_ERROR_MULTI, "object def rcurly", 6, "8, 12"), + "85:11: " + getCheckMessage(MSG_ERROR, "method def modifier", 10, 12), + "87:11: " + getCheckMessage(MSG_ERROR, "method def rcurly", 10, 12), }; verifyWarns(checkConfig, fileName, expected); } @@ -1611,29 +1913,48 @@ public void testInvalidBlockWithChecker() "70:11: " + getCheckMessage(MSG_ERROR, "block lcurly", 10, 12), "71:15: " + getCheckMessage(MSG_CHILD_ERROR, "block", 14, 16), "86:11: " + getCheckMessage(MSG_ERROR, "block rcurly", 10, 12), - "95:3: " + getCheckMessage(MSG_ERROR, "static initialization", 2, 4), - "96:7: " + getCheckMessage(MSG_ERROR, "static initialization", 6, 4), - "100:8: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 7, 8), - "103:7: " + getCheckMessage(MSG_ERROR, "static initialization", 6, 4), - "105:3: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 2, 4), - "107:3: " + getCheckMessage(MSG_ERROR, "static initialization", 2, 4), - "109:7: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 6, 4), - "111:3: " + getCheckMessage(MSG_ERROR, "static initialization", 2, 4), - "113:7: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 6, 8), - "116:3: " + getCheckMessage(MSG_ERROR, "static initialization lcurly", 2, 4), - "117:7: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 6, 8), - "118:7: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 6, 4), - "123:7: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 6, 8), - "128:5: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 4, 8), - "129:3: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 2, 4), - "134:7: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 6, 4), - "137:3: " + getCheckMessage(MSG_ERROR, "block lcurly", 2, 4), - "138:7: " + getCheckMessage(MSG_ERROR, "block lcurly", 6, 4), - "141:3: " + getCheckMessage(MSG_ERROR, "block lcurly", 2, 4), - "143:7: " + getCheckMessage(MSG_ERROR, "block rcurly", 6, 4), - "145:7: " + getCheckMessage(MSG_ERROR, "block lcurly", 6, 4), - "147:3: " + getCheckMessage(MSG_ERROR, "block rcurly", 2, 4), - "150:7: " + getCheckMessage(MSG_CHILD_ERROR, "block", 6, 8), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidBlockWithChecker1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidBlockIndent1.java"); + final String[] expected = { + "27:3: " + getCheckMessage(MSG_ERROR, "static initialization", 2, 4), + "28:7: " + getCheckMessage(MSG_ERROR, "static initialization", 6, 4), + "32:8: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 7, 8), + "35:7: " + getCheckMessage(MSG_ERROR, "static initialization", 6, 4), + "37:3: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 2, 4), + "39:3: " + getCheckMessage(MSG_ERROR, "static initialization", 2, 4), + "41:7: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 6, 4), + "43:3: " + getCheckMessage(MSG_ERROR, "static initialization", 2, 4), + "45:7: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 6, 8), + "48:3: " + getCheckMessage(MSG_ERROR, "static initialization lcurly", 2, 4), + "49:7: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 6, 8), + "50:7: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 6, 4), + "55:7: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 6, 8), + "60:5: " + getCheckMessage(MSG_CHILD_ERROR, "static initialization", 4, 8), + "61:3: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 2, 4), + "66:7: " + getCheckMessage(MSG_ERROR, "static initialization rcurly", 6, 4), + "69:3: " + getCheckMessage(MSG_ERROR, "block lcurly", 2, 4), + "70:7: " + getCheckMessage(MSG_ERROR, "block lcurly", 6, 4), + "73:3: " + getCheckMessage(MSG_ERROR, "block lcurly", 2, 4), + "75:7: " + getCheckMessage(MSG_ERROR, "block rcurly", 6, 4), + "77:7: " + getCheckMessage(MSG_ERROR, "block lcurly", 6, 4), + "79:3: " + getCheckMessage(MSG_ERROR, "block rcurly", 2, 4), + "82:7: " + getCheckMessage(MSG_CHILD_ERROR, "block", 6, 8), }; verifyWarns(checkConfig, fileName, expected); } @@ -1686,54 +2007,90 @@ public void testInvalidIfWithChecker() "104:12: " + getCheckMessage(MSG_ERROR, "if rcurly", 11, 8), "105:6: " + getCheckMessage(MSG_ERROR, "else", 5, 8), "106:12: " + getCheckMessage(MSG_ERROR, "else rcurly", 11, 8), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidIfWithChecker1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidIfIndent1.java"); + final String[] expected = { + "37:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), + "42:11: " + getCheckMessage(MSG_ERROR, "if lcurly", 10, 8), + "43:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), + "48:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), + "49:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), + "51:11: " + getCheckMessage(MSG_CHILD_ERROR, "else", 10, 12), + "52:9: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 8, 12), + + "59:17: " + getCheckMessage(MSG_CHILD_ERROR, "if", 16, 12), + "60:10: " + getCheckMessage(MSG_ERROR, "if rcurly", 9, 8), + "63:17: " + getCheckMessage(MSG_CHILD_ERROR, "else", 16, 12), + "69:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), + "73:41: " + getCheckMessage(MSG_CHILD_ERROR, "else", 40, 12), + "80:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), + + "83:15: " + getCheckMessage(MSG_CHILD_ERROR, "else", 14, 12), + "89:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), + "91:11: " + getCheckMessage(MSG_CHILD_ERROR, "else", 10, 12), + "95:11: " + getCheckMessage(MSG_ERROR, "if", 10, 8), + "96:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), + "97:11: " + getCheckMessage(MSG_ERROR, "if rcurly", 10, 8), + "98:11: " + getCheckMessage(MSG_ERROR, "else", 10, 8), + "99:15: " + getCheckMessage(MSG_CHILD_ERROR, "else", 14, 12), + "100:11: " + getCheckMessage(MSG_ERROR, "else rcurly", 10, 8), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInvalidIfWithChecker2() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationInvalidIfIndent2.java"); + final String[] expected = { + "26:10: " + getCheckMessage(MSG_CHILD_ERROR, "if", 9, 12), + "27:12: " + getCheckMessage(MSG_CHILD_ERROR, "if", 11, 12), + "31:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), + "34:8: " + getCheckMessage(MSG_ERROR, "if rcurly", 7, 8), + "41:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), + "43:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "126:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), - "131:11: " + getCheckMessage(MSG_ERROR, "if lcurly", 10, 8), - "132:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "137:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), - "138:11: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 10, 12), - "140:11: " + getCheckMessage(MSG_CHILD_ERROR, "else", 10, 12), - "141:9: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 8, 12), - - "148:17: " + getCheckMessage(MSG_CHILD_ERROR, "if", 16, 12), - "149:10: " + getCheckMessage(MSG_ERROR, "if rcurly", 9, 8), - "152:17: " + getCheckMessage(MSG_CHILD_ERROR, "else", 16, 12), - "158:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), - "162:41: " + getCheckMessage(MSG_CHILD_ERROR, "else", 40, 12), - "169:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), - - "172:15: " + getCheckMessage(MSG_CHILD_ERROR, "else", 14, 12), - "178:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "180:11: " + getCheckMessage(MSG_CHILD_ERROR, "else", 10, 12), - "184:11: " + getCheckMessage(MSG_ERROR, "if", 10, 8), - "185:15: " + getCheckMessage(MSG_CHILD_ERROR, "if", 14, 12), - "186:11: " + getCheckMessage(MSG_ERROR, "if rcurly", 10, 8), - "187:11: " + getCheckMessage(MSG_ERROR, "else", 10, 8), - - "188:15: " + getCheckMessage(MSG_CHILD_ERROR, "else", 14, 12), - "189:11: " + getCheckMessage(MSG_ERROR, "else rcurly", 10, 8), - "192:10: " + getCheckMessage(MSG_CHILD_ERROR, "if", 9, 12), - "193:12: " + getCheckMessage(MSG_CHILD_ERROR, "if", 11, 12), - "197:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "200:8: " + getCheckMessage(MSG_ERROR, "if rcurly", 7, 8), - "207:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "209:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - - "216:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), - "225:11: " + getCheckMessage(MSG_ERROR, "if", 10, 12), - "229:19: " + getCheckMessage(MSG_CHILD_ERROR, "if", 18, 20), - "240:11: " + getCheckMessage(MSG_ERROR, "if rparen", 10, 8), - "245:7: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8), - "251:7: " + getCheckMessage(MSG_ERROR, "if lparen", 6, 8), - "253:7: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8), - "256:1: " + getCheckMessage(MSG_ERROR, "if", 0, 8), - "257:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), - "258:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), - "259:1: " + getCheckMessage(MSG_ERROR, "if rcurly", 0, 8), - "260:1: " + getCheckMessage(MSG_ERROR, "if", 0, 8), - "261:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), - "262:1: " + getCheckMessage(MSG_ERROR, "else", 0, 8), - "263:1: " + getCheckMessage(MSG_CHILD_ERROR, "else", 0, 12), + "50:11: " + getCheckMessage(MSG_CHILD_ERROR, "if", 10, 12), + "59:11: " + getCheckMessage(MSG_ERROR, "if", 10, 12), + "63:19: " + getCheckMessage(MSG_CHILD_ERROR, "if", 18, 20), + "74:11: " + getCheckMessage(MSG_ERROR, "if rparen", 10, 8), + "79:7: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8), + "85:7: " + getCheckMessage(MSG_ERROR, "if lparen", 6, 8), + "87:7: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8), + "90:1: " + getCheckMessage(MSG_ERROR, "if", 0, 8), + "91:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), + "92:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), + "93:1: " + getCheckMessage(MSG_ERROR, "if rcurly", 0, 8), + "94:1: " + getCheckMessage(MSG_ERROR, "if", 0, 8), + "95:1: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), + "96:1: " + getCheckMessage(MSG_ERROR, "else", 0, 8), + "97:1: " + getCheckMessage(MSG_CHILD_ERROR, "else", 0, 12), }; verifyWarns(checkConfig, fileName, expected); } @@ -1948,6 +2305,24 @@ public void testValidBlockWithChecker() verifyWarns(checkConfig, fileName, expected); } + @Test + public void testValidBlockWithChecker1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationValidBlockIndent1.java"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, fileName, expected); + } + @Test public void testValidWhileWithChecker() throws Exception { @@ -1981,8 +2356,27 @@ public void testValidClassDefWithChecker() checkConfig.addProperty("throwsIndent", "4"); final String fileName = getPath("InputIndentationValidClassDefIndent.java"); final String[] expected = { - "49:1: " + getCheckMessage(MSG_ERROR, "class", 0, 4), - "71:9: " + getCheckMessage(MSG_ERROR, "int", 8, 12), + "38:9: " + getCheckMessage(MSG_ERROR, "int", 8, 12), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testValidClassDefWithChecker1() + throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("caseIndent", "4"); + checkConfig.addProperty("forceStrictCondition", "false"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("throwsIndent", "4"); + final String fileName = getPath("InputIndentationValidClassDefIndent1.java"); + final String[] expected = { + "43:1: " + getCheckMessage(MSG_ERROR, "class", 0, 4), }; verifyWarns(checkConfig, fileName, expected); } @@ -2366,6 +2760,23 @@ public void testPackageDeclaration4() throws Exception { verifyWarns(checkConfig, getPath("InputIndentationPackageDeclaration4.java"), expected); } + @Test + public void testLambda() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "2"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + final String[] expected = { + "37:6: " + getCheckMessage(MSG_ERROR_MULTI, "block lcurly", 5, "4, 8"), + "38:6: " + getCheckMessage(MSG_ERROR_MULTI, "block rcurly", 5, "4, 8"), + "42:12: " + getCheckMessage(MSG_ERROR, "lambda", 11, 12), + "43:10: " + getCheckMessage(MSG_ERROR, "block lcurly", 9, 8), + "55:8: " + getCheckMessage(MSG_CHILD_ERROR, "block", 7, 6), + "56:6: " + getCheckMessage(MSG_ERROR, "block rcurly", 5, 4), + }; + verifyWarns(checkConfig, getPath("InputIndentationLambda.java"), expected); + } + @Test public void testLambda1() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -2373,15 +2784,9 @@ public void testLambda1() throws Exception { checkConfig.addProperty("basicOffset", "2"); checkConfig.addProperty("lineWrappingIndentation", "4"); final String[] expected = { - "46:6: " + getCheckMessage(MSG_ERROR_MULTI, "block lcurly", 5, "4, 8"), - "47:6: " + getCheckMessage(MSG_ERROR_MULTI, "block rcurly", 5, "4, 8"), - "51:12: " + getCheckMessage(MSG_ERROR, "lambda", 11, 12), - "52:10: " + getCheckMessage(MSG_ERROR, "block lcurly", 9, 8), - "64:8: " + getCheckMessage(MSG_CHILD_ERROR, "block", 7, 6), - "65:6: " + getCheckMessage(MSG_ERROR, "block rcurly", 5, 4), - "179:10: " + getCheckMessage(MSG_CHILD_ERROR, "block", 9, 10), - "180:12: " + getCheckMessage(MSG_CHILD_ERROR, "block", 11, 10), - "185:8: " + getCheckMessage(MSG_ERROR, "block rcurly", 7, 8), + "68:10: " + getCheckMessage(MSG_CHILD_ERROR, "block", 9, 10), + "69:12: " + getCheckMessage(MSG_CHILD_ERROR, "block", 11, 10), + "74:8: " + getCheckMessage(MSG_ERROR, "block rcurly", 7, 8), }; verifyWarns(checkConfig, getPath("InputIndentationLambda1.java"), expected); } @@ -2545,6 +2950,18 @@ public void testMultipleAnnotationsWithWrappedLines() throws Exception { verifyWarns(checkConfig, fileName, expected); } + @Test + public void testMultipleAnnotationsWithWrappedLines1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("forceStrictCondition", "true"); + final String fileName = + getPath("InputIndentationCorrectMultipleAnnotationsWithWrappedLines1.java"); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWarns(checkConfig, fileName, expected); + } + @Test public void testMethodPrecedeByAnnotationsWithParameterOnSeparateLine() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); @@ -2627,12 +3044,27 @@ public void testInputAnnotationDefIndentationCheck() throws Exception { "61:5: " + getCheckMessage(MSG_ERROR, "annotation def rcurly", 4, 0), "72:4: " + getCheckMessage(MSG_ERROR, "annotation def modifier", 3, 4), "87:29: " + getCheckMessage(MSG_ERROR_MULTI, "new", 28, "20, 24"), - "117:6: " + getCheckMessage(MSG_ERROR, "annotation def modifier", 5, 4), - "128:2: " + getCheckMessage(MSG_ERROR, "interface", 1, 0), - "134:12: " + getCheckMessage(MSG_ERROR, "@", 11, 0), - "137:17: " + getCheckMessage(MSG_ERROR, "@", 16, 0), - "144:13: " + getCheckMessage(MSG_ERROR, "@", 12, 4), - "148:23: " + getCheckMessage(MSG_ERROR, "class def ident", 16, 0), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testInputAnnotationDefIndentationCheck1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("arrayInitIndent", "4"); + checkConfig.addProperty("basicOffset", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + checkConfig.addProperty("forceStrictCondition", "true"); + final String fileName = getPath("InputIndentationCustomAnnotation1.java"); + final String[] expected = { + "36:6: " + getCheckMessage(MSG_ERROR, "annotation def modifier", 5, 4), + "47:2: " + getCheckMessage(MSG_ERROR, "interface", 1, 0), + "53:12: " + getCheckMessage(MSG_ERROR, "@", 11, 0), + "56:17: " + getCheckMessage(MSG_ERROR, "@", 16, 0), + "63:13: " + getCheckMessage(MSG_ERROR, "@", 12, 4), + "67:23: " + getCheckMessage(MSG_ERROR, "class def ident", 16, 0), }; verifyWarns(checkConfig, fileName, expected); } @@ -2651,23 +3083,36 @@ public void testTryResourcesStrict() throws Exception { "33:1: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 0, 16), "39:1: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 0, 12), "59:21: " + getCheckMessage(MSG_ERROR, "try resource", 20, 16), - "84:20: " + getCheckMessage(MSG_ERROR, "writ", 19, 12), - "91:20: " + getCheckMessage(MSG_ERROR, "writ", 19, 16), - "98:22: " + getCheckMessage(MSG_ERROR, "writ", 21, 16), - "113:18: " + getCheckMessage(MSG_ERROR, "zipFileName", 17, 16), - "120:16: " + getCheckMessage(MSG_ERROR, "zipFileName", 15, 16), - "130:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), - "135:16: " + getCheckMessage(MSG_CHILD_ERROR, "try", 15, 12), - "141:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), - "142:10: " + getCheckMessage(MSG_CHILD_ERROR, "try", 9, 12), - "146:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), - "147:12: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 11, 16), - "148:14: " + getCheckMessage(MSG_CHILD_ERROR, "try", 13, 12), - "150:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), - "151:8: " + getCheckMessage(MSG_ERROR_MULTI, "try rparen", 7, "8, 12"), - "155:10: " + getCheckMessage(MSG_ERROR, "try", 9, 8), - "161:14: " + getCheckMessage(MSG_ERROR, ".", 13, 12), - "167:12: " + getCheckMessage(MSG_ERROR, ".", 11, 12), + "79:14: " + getCheckMessage(MSG_ERROR, ".", 13, 12), + "85:12: " + getCheckMessage(MSG_ERROR, ".", 11, 12), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testTryResourcesStrict1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("forceStrictCondition", "true"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + final String fileName = getPath("InputIndentationTryWithResourcesStrict1.java"); + final String[] expected = { + "31:20: " + getCheckMessage(MSG_ERROR, "writ", 19, 12), + "38:20: " + getCheckMessage(MSG_ERROR, "writ", 19, 16), + "45:22: " + getCheckMessage(MSG_ERROR, "writ", 21, 16), + "60:18: " + getCheckMessage(MSG_ERROR, "zipFileName", 17, 16), + "67:16: " + getCheckMessage(MSG_ERROR, "zipFileName", 15, 16), + "77:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), + "82:16: " + getCheckMessage(MSG_CHILD_ERROR, "try", 15, 12), + "88:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), + "89:10: " + getCheckMessage(MSG_CHILD_ERROR, "try", 9, 12), + "93:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), + "94:12: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 11, 16), + "95:14: " + getCheckMessage(MSG_CHILD_ERROR, "try", 13, 12), + "97:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), + "98:8: " + getCheckMessage(MSG_ERROR_MULTI, "try rparen", 7, "8, 12"), + "102:10: " + getCheckMessage(MSG_ERROR, "try", 9, 8), }; verifyWarns(checkConfig, fileName, expected); } @@ -2680,21 +3125,33 @@ public void testTryResourcesNotStrict() throws Exception { checkConfig.addProperty("lineWrappingIndentation", "4"); final String fileName = getPath("InputIndentationTryResourcesNotStrict.java"); final String[] expected = { - "27:1: " + getCheckMessage(MSG_ERROR, "try resource", 0, 12), - "33:1: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 0, 16), - "39:1: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 0, 12), - "120:16: " + getCheckMessage(MSG_ERROR, "zipFileName", 15, 16), - "130:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), - "135:16: " + getCheckMessage(MSG_CHILD_ERROR, "try", 15, 12), - "141:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), - "142:10: " + getCheckMessage(MSG_CHILD_ERROR, "try", 9, 12), - "146:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), - "147:12: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 11, 16), - "148:14: " + getCheckMessage(MSG_CHILD_ERROR, "try", 13, 12), - "150:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), - "151:8: " + getCheckMessage(MSG_ERROR_MULTI, "try rparen", 7, "8, 12"), - "164:9: " + getCheckMessage(MSG_ERROR, ".", 8, 12), - "172:12: " + getCheckMessage(MSG_ERROR, "new", 11, 12), + "26:1: " + getCheckMessage(MSG_ERROR, "try resource", 0, 12), + "32:1: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 0, 16), + "38:1: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 0, 12), + }; + verifyWarns(checkConfig, fileName, expected); + } + + @Test + public void testTryResourcesNotStrict1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("braceAdjustment", "0"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + final String fileName = getPath("InputIndentationTryResourcesNotStrict1.java"); + final String[] expected = { + "44:16: " + getCheckMessage(MSG_ERROR, "zipFileName", 15, 16), + "54:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), + "59:16: " + getCheckMessage(MSG_CHILD_ERROR, "try", 15, 12), + "65:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), + "66:10: " + getCheckMessage(MSG_CHILD_ERROR, "try", 9, 12), + "70:12: " + getCheckMessage(MSG_ERROR, "try resource", 11, 12), + "71:12: " + getCheckMessage(MSG_ERROR, "newBufferedWriter", 11, 16), + "72:14: " + getCheckMessage(MSG_CHILD_ERROR, "try", 13, 12), + "74:8: " + getCheckMessage(MSG_ERROR, "try", 7, 8), + "75:8: " + getCheckMessage(MSG_ERROR_MULTI, "try rparen", 7, "8, 12"), + "88:9: " + getCheckMessage(MSG_ERROR, ".", 8, 12), + "96:12: " + getCheckMessage(MSG_ERROR, "new", 11, 12), }; verifyWarns(checkConfig, fileName, expected); } @@ -3046,6 +3503,127 @@ public void testIndentationLongConcatenatedString() throws Exception { expected); } + @Test + public void testIndentationLongConcatenatedString1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString1.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString2() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString2.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString3() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString3.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString4() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString4.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString5() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString5.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString6() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString6.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString7() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString7.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString8() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString8.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString9() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString9.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString10() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString10.java"), + expected); + } + + @Test + public void testIndentationLongConcatenatedString11() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWarns(checkConfig, getPath("InputIndentationLongConcatenatedString11.java"), + expected); + } + @Test public void testIndentationLineBreakVariableDeclaration() throws Exception { @@ -3155,6 +3733,43 @@ public void testIndentationRecordPattern() verifyWarns(checkConfig, fileName, expected); } + @Test + public void testIndentationCodeBlocks1() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "2"); + checkConfig.addProperty("caseIndent", "2"); + checkConfig.addProperty("throwsIndent", "4"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + final String[] expected = { + "17:5: " + getCheckMessage(MSG_ERROR, "block lcurly", 4, 2), + "18:7: " + getCheckMessage(MSG_CHILD_ERROR, "block", 6, 4), + "19:5: " + getCheckMessage(MSG_ERROR, "block rcurly", 4, 2), + "30:5: " + getCheckMessage(MSG_ERROR, "block lcurly", 4, 2), + "31:7: " + getCheckMessage(MSG_CHILD_ERROR, "block", 6, 4), + "32:5: " + getCheckMessage(MSG_ERROR, "block rcurly", 4, 2), + }; + verifyWarns(checkConfig, getPath("InputIndentationCodeBlocks1.java"), expected); + } + + @Test + public void testIndentationCodeBlocks2() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + checkConfig.addProperty("basicOffset", "2"); + checkConfig.addProperty("braceAdjustment", "2"); + checkConfig.addProperty("throwsIndent", "4"); + checkConfig.addProperty("caseIndent", "2"); + checkConfig.addProperty("lineWrappingIndentation", "4"); + final String[] expected = { + "45:13: " + getCheckMessage(MSG_ERROR, "for lcurly", 12, 14), + "47:13: " + getCheckMessage(MSG_ERROR, "for rcurly", 12, 14), + }; + verifyWarns(checkConfig, + getNonCompilablePath("InputIndentationCodeBlocks2.java"), expected); + } + @Test public void testIndentationSealedClasses() throws Exception { diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest.java index d0103a66599..ccb30daa255 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest.java @@ -21,6 +21,8 @@ import static com.google.common.truth.Truth.assertWithMessage; +import java.util.Arrays; + import org.junit.jupiter.api.Test; import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; @@ -33,13 +35,19 @@ public void testToString() { javadocNode.setType(JavadocTokenTypes.CODE_LITERAL); javadocNode.setLineNumber(1); javadocNode.setColumnNumber(2); + final JavadocNodeImpl child1 = new JavadocNodeImpl(); + final JavadocNodeImpl child2 = new JavadocNodeImpl(); + child1.setType(JavadocTokenTypes.CODE_LITERAL); + child2.setType(JavadocTokenTypes.CODE_LITERAL); + javadocNode.setChildren(child1, child2); final String result = javadocNode.toString(); assertWithMessage("Invalid toString result") .that(result) .isEqualTo("JavadocNodeImpl[index=0, type=CODE_LITERAL, text='null', lineNumber=1," - + " columnNumber=2, children=0, parent=null]"); + + " columnNumber=2, children=" + Arrays.hashCode(javadocNode.getChildren()) + + ", parent=null]"); } @Test diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java index dee02c4e11a..2ec03228a67 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java @@ -81,10 +81,8 @@ public void testIncorrect() throws Exception { "87:11: " + getCheckMessage(MSG_TAG_AFTER), "97:27: " + getCheckMessage(MSG_LINE_BEFORE), "99:13: " + getCheckMessage(MSG_MISPLACED_TAG), - "102:36: " + getCheckMessage(MSG_MISPLACED_TAG), - "102:36: " + getCheckMessage(MSG_LINE_BEFORE), - "112:11: " + getCheckMessage(MSG_TAG_AFTER), - "113:11: " + getCheckMessage(MSG_TAG_AFTER), + "109:11: " + getCheckMessage(MSG_TAG_AFTER), + "110:11: " + getCheckMessage(MSG_TAG_AFTER), }; verifyWithInlineConfigParser( getPath("InputJavadocParagraphIncorrect.java"), expected); @@ -95,11 +93,10 @@ public void testIncorrect2() throws Exception { final String[] expected = { "14:4: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "h1"), "22:7: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "ul"), - "24:11: " + getCheckMessage(MSG_LINE_BEFORE), - "38:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "table"), - "50:8: " + getCheckMessage(MSG_MISPLACED_TAG), - "52:8: " + getCheckMessage(MSG_MISPLACED_TAG), - "52:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "ol"), + "37:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "table"), + "49:8: " + getCheckMessage(MSG_MISPLACED_TAG), + "51:8: " + getCheckMessage(MSG_MISPLACED_TAG), + "51:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "ol"), }; verifyWithInlineConfigParser( getPath("InputJavadocParagraphIncorrect4.java"), expected); @@ -154,10 +151,8 @@ public void testAllowNewlineParagraph2() throws Exception { "30:27: " + getCheckMessage(MSG_MISPLACED_TAG), "30:27: " + getCheckMessage(MSG_LINE_BEFORE), "32:13: " + getCheckMessage(MSG_MISPLACED_TAG), - "35:36: " + getCheckMessage(MSG_MISPLACED_TAG), - "35:36: " + getCheckMessage(MSG_LINE_BEFORE), - "45:11: " + getCheckMessage(MSG_TAG_AFTER), - "46:11: " + getCheckMessage(MSG_TAG_AFTER), + "42:11: " + getCheckMessage(MSG_TAG_AFTER), + "43:11: " + getCheckMessage(MSG_TAG_AFTER), }; verifyWithInlineConfigParser( getPath("InputJavadocParagraphIncorrect3.java"), expected); @@ -166,19 +161,11 @@ public void testAllowNewlineParagraph2() throws Exception { @Test public void testAllowNewlineParagraph3() throws Exception { final String[] expected = { - "15:12: " + getCheckMessage(MSG_LINE_BEFORE), - "17:15: " + getCheckMessage(MSG_LINE_BEFORE), - "20:9: " + getCheckMessage(MSG_MISPLACED_TAG), - "20:9: " + getCheckMessage(MSG_LINE_BEFORE), - "34:11: " + getCheckMessage(MSG_LINE_BEFORE), - "38:8: " + getCheckMessage(MSG_LINE_BEFORE), - "44:8: " + getCheckMessage(MSG_LINE_BEFORE), - "48:8: " + getCheckMessage(MSG_MISPLACED_TAG), - "52:8: " + getCheckMessage(MSG_MISPLACED_TAG), - "52:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "h1"), - "67:11: " + getCheckMessage(MSG_LINE_BEFORE), - "80:8: " + getCheckMessage(MSG_MISPLACED_TAG), - "80:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "ul"), + "42:8: " + getCheckMessage(MSG_MISPLACED_TAG), + "46:8: " + getCheckMessage(MSG_MISPLACED_TAG), + "46:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "h1"), + "73:8: " + getCheckMessage(MSG_MISPLACED_TAG), + "73:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "ul"), }; verifyWithInlineConfigParser( getPath("InputJavadocParagraphIncorrect5.java"), expected); @@ -191,7 +178,6 @@ public void testJavadocParagraph() throws Exception { "28:7: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH), "31:7: " + getCheckMessage(MSG_LINE_BEFORE), "50:7: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "ul"), - "65:8: " + getCheckMessage(MSG_LINE_BEFORE), "76:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "table"), "87:8: " + getCheckMessage(MSG_PRECEDED_BLOCK_TAG, "pre"), }; @@ -266,4 +252,12 @@ public void testIncorrect3() throws Exception { verifyWithInlineConfigParser( getPath("InputJavadocParagraphIncorrect6.java"), expected); } + + @Test + public void testJavadocParagraphNested() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWithInlineConfigParser( + getPath("InputJavadocParagraphNested.java"), expected); + } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java index 80f6917471c..e10baeb284f 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java @@ -97,6 +97,8 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { getAllowedDirectoryAndChecks(); private static final Set INTERNAL_MODULES = getInternalModules(); + private static final DirectoryStream.Filter IS_DIRECTORY = path + -> path.toFile().isDirectory(); private Path javaDir; private Path inputDir; @@ -212,7 +214,7 @@ public void validateIntegrationTestClassNames() throws Exception { @Test public void validateInputFiles() throws Exception { - try (DirectoryStream dirs = Files.newDirectoryStream(inputDir)) { + try (DirectoryStream dirs = Files.newDirectoryStream(inputDir, IS_DIRECTORY)) { for (Path dir : dirs) { // input directory must be named in lower case assertWithMessage(dir + " is not a directory") diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsRecords.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsRecords.java index efaed7bea80..8051c133ef7 100644 --- a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsRecords.java +++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsRecords.java @@ -10,7 +10,7 @@ public class InputCovariantEqualsRecords { public record MyRecord1() { - public boolean equals(String str) { // violation + public boolean equals(String str) { // violation 'covariant equals' return str.equals(this); } } @@ -26,7 +26,7 @@ public boolean equals(Object obj) { public record MyRecord3() { record MyInnerRecord() { - public boolean equals(String str) { // violation + public boolean equals(String str) { // violation 'covariant equals' return str.equals(this); } } diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCodeBlocks2.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCodeBlocks2.java new file mode 100644 index 00000000000..632fb4e293f --- /dev/null +++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCodeBlocks2.java @@ -0,0 +1,63 @@ + +//non-compiled with javac: Compilable with Java17 //indent:0 exp:0 + +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 2 //indent:1 exp:1 + * caseIndent = 2 //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationCodeBlocks2 { //indent:0 exp:0 + public void testSwitchCases(int j) { //indent:2 exp:2 + switch (j) { //indent:4 exp:4 + case 1: //indent:6 exp:6 + { //indent:8 exp:8 + System.out.println("One"); //indent:10 exp:10 + break; //indent:10 exp:10 + } //indent:8 exp:8 + case 2: //indent:6 exp:6 + { //indent:8 exp:8 + System.out.println("2"); //indent:10 exp:10 + break; //indent:10 exp:10 + } //indent:8 exp:8 + default: //indent:6 exp:6 + System.out.println("default"); //indent:8 exp:8 + } //indent:4 exp:4 + final int status = //indent:4 exp:4 + switch (j) { //indent:8 exp:8 + case 1 -> 502; //indent:10 exp:10 + case 10 -> 502; //indent:10 exp:10 + case 110 -> 504; //indent:10 exp:10 + default -> 500; //indent:10 exp:10 + }; //indent:8 exp:8 + + switch (j) { //indent:4 exp:4 + case 2: //indent:6 exp:6 + if (status + 10 > 100) { //indent:8 exp:8 + { //indent:10 exp:10 + for (int _i1 = 0; _i1 < -5; ++_i1) //indent:12 exp:12 + { //indent:12 exp:14 warn + System.out.println("sout"); //indent:14 exp:14 + } //indent:12 exp:14 warn + } //indent:10 exp:10 + } else { //indent:8 exp:8 + System.out.println("souta"); //indent:10 exp:10 + } //indent:8 exp:8 + } //indent:4 exp:4 + + if (j < -1) { //indent:4 exp:4 + { //indent:6 exp:6 + for (int i = 0; i < 1; i++) //indent:8 exp:8 + { //indent:10 exp:10 + System.out.println("sout"); //indent:12 exp:12 + } //indent:10 exp:10 + } //indent:6 exp:6 + } //indent:4 exp:4 + } //indent:2 exp:2 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsOne.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsOne.java index e59b301a2a5..5e782cc3147 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsOne.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsOne.java @@ -14,7 +14,7 @@ public class InputCovariantEqualsOne { private class Inner { - public boolean equals(Inner aInner) // violation + public boolean equals(Inner aInner) // violation 'covariant equals' { return false; } @@ -33,7 +33,7 @@ public boolean equals(Object aObj) } } - public boolean equals(InputCovariantEqualsOne aInputCovariantEquals) // violation + public boolean equals(InputCovariantEqualsOne obj) // violation 'covariant equals' { return false; } @@ -67,7 +67,7 @@ public boolean equals(java.lang.Object aObject) class InputCovariant4 { - public boolean equals(int i) // violation + public boolean equals(int i) // violation 'covariant equals' { return false; } @@ -81,7 +81,7 @@ public int compareTo(Object aObject) { return 0; } - public boolean equals(String aString) // violation + public boolean equals(String aString) // violation 'covariant equals' { return false; } @@ -107,4 +107,3 @@ interface InputCovariant6 { public boolean equals(InputCovariant5 aInputCovariant5); } - diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsTwo.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsTwo.java index 4b7664f0e16..38675f11328 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsTwo.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/InputCovariantEqualsTwo.java @@ -38,11 +38,11 @@ public boolean equals(Object aObject) enum InputEnumCovariant { EQUALS; - public boolean equals(InputEnumCovariant inputEnumCovariant) { // violation + public boolean equals(InputEnumCovariant obj) { // violation 'covariant equals' return false; } - int equals(Integer integer) { // violation + int equals(Integer integer) { // violation 'covariant equals' return 0; } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCodeBlocks1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCodeBlocks1.java new file mode 100644 index 00000000000..779f9abb33b --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCodeBlocks1.java @@ -0,0 +1,58 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 2 //indent:1 exp:1 + * caseIndent = 2 //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationCodeBlocks1 { //indent:0 exp:0 + { //indent:2 exp:2 + System.out.println("True"); //indent:4 exp:4 + } //indent:2 exp:2 + { //indent:4 exp:2 warn + System.out.println("False"); //indent:6 exp:4 warn + } //indent:4 exp:2 warn + private static void test(int condition) { //indent:2 exp:2 + { //indent:4 exp:4 + System.out.println("True"); //indent:6 exp:6 + } //indent:4 exp:4 + } //indent:2 exp:2 + + { //indent:2 exp:2 + System.out.println("False"); //indent:4 exp:4 + } //indent:2 exp:2 + + { //indent:4 exp:2 warn + System.out.println("False"); //indent:6 exp:4 warn + } //indent:4 exp:2 warn + + public void testSwitchCases(int j) { //indent:2 exp:2 + switch (j) { //indent:4 exp:4 + case 1: //indent:6 exp:6 + { //indent:8 exp:8 + System.out.println("One"); //indent:10 exp:10 + break; //indent:10 exp:10 + } //indent:8 exp:8 + case 2: //indent:6 exp:6 + { //indent:8 exp:8 + test(2); //indent:10 exp:10 + break; //indent:10 exp:10 + } //indent:8 exp:8 + default: //indent:6 exp:6 + System.out.println("default"); //indent:8 exp:8 + } //indent:4 exp:4 + } //indent:2 exp:2 + + class Inner { //indent:2 exp:2 + void test() { //indent:4 exp:4 + { //indent:6 exp:6 + System.out.println("True"); //indent:8 exp:8 + } //indent:6 exp:6 + } //indent:4 exp:4 + } //indent:2 exp:2 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter.java index 24bbbab7899..454bd3f3b2e 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter.java @@ -16,67 +16,42 @@ */ //indent:1 exp:1 class InputIndentationCorrectIfAndParameter { //indent:0 exp:0 - String getString(int someInt, String someString) { //indent:2 exp:2 + static 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 - SecondClassLongNam7("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new InputIndentationCorrectIfAndParameter(), "Looooog"), //indent:8 exp:8 - new InnerClassFoo())) {} //indent:8 exp:8 - - if (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongNam7("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new InputIndentationCorrectIfAndParameter(), //indent:8 exp:8 - new SecondClassLongNam7("loooooooooong"). //indent:8 exp:10,12 warn - getInteger(new InputIndentationCorrectIfAndParameter(), "long")), "loong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongNam7("Looooooooooooooo" //indent:8 exp:8 - + "oo").gB(new InputIndentationCorrectIfAndParameter(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongNam7(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).gB( //indent:8 exp:8 - new InputIndentationCorrectIfAndParameter(), true)) //indent:8 exp:10,12 warn - || co(false, new //indent:8 exp:8 - SecondClassLongNam7(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 + static 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 + static 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 + static 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 + static 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 + static boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 return false; //indent:4 exp:4 } //indent:2 exp:2 - private boolean co(boolean flag, //indent:2 exp:2 + static boolean co(boolean flag, //indent:2 exp:2 SecondClassLongNam7 instance) { //indent:6 exp:6 return false; //indent:4 exp:4 } //indent:2 exp:2 - private boolean conditionNoArg() { //indent:2 exp:2 + static boolean conditionNoArg() { //indent:2 exp:2 return false; //indent:4 exp:4 } //indent:2 exp:2 - class InnerClassFoo { //indent:2 exp:2 + static class InnerClassFoo { //indent:2 exp:2 void fooMethodWithIf() { //indent:4 exp:4 if (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 @@ -134,27 +109,3 @@ void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 e }; //indent:4 exp:4 } //indent:2 exp:2 } //indent:0 exp:0 - -class SecondClassLongNam7 { //indent:0 exp:0 - - public SecondClassLongNam7(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(InputIndentationCorrectIfAndParameter instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(InputIndentationCorrectIfAndParameter instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean gB(InputIndentationCorrectIfAndParameter instance,boolean flag){ //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongNam7 getInstance() { //indent:2 exp:2 - return new SecondClassLongNam7("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter1.java new file mode 100644 index 00000000000..0ea42cd3b7d --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectIfAndParameter1.java @@ -0,0 +1,76 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.co; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.conditionFifth; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.conditionFirst; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.conditionFourth; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.conditionNoArg; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.conditionSecond; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.conditionThird; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation.InputIndentationCorrectIfAndParameter.getString; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationCorrectIfAndParameter1 { //indent:0 exp:0 + + void fooMethodWithIf() { //indent:2 exp:2 + + if (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 + SecondClassLongNam7("Loooooooooooooooooog"). //indent:8 exp:8 + getInteger(new InputIndentationCorrectIfAndParameter(), "Looooog"), //indent:8 exp:8 + new InputIndentationCorrectIfAndParameter.InnerClassFoo())) {} //indent:8 exp:8 + + if (conditionSecond(10000000000.0, new //indent:4 exp:4 + SecondClassLongNam7("Looooooooooooo" //indent:8 exp:8 + + "oooooooooooong").getString(new InputIndentationCorrectIfAndParameter(), //indent:8 exp:8 + new SecondClassLongNam7("loooooooooong"). //indent:8 exp:10,12 warn + getInteger(new InputIndentationCorrectIfAndParameter(), "long")), "loong") //indent:8 exp:8 + || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 + SecondClassLongNam7("Looooooooooooooo" //indent:8 exp:8 + + "oo").gB(new InputIndentationCorrectIfAndParameter(), false)) || //indent:8 exp:8 + conditionFifth(true, new SecondClassLongNam7(getString(2048, "Looo" //indent:8 exp:8 + + "ooooooooooooooooooooooooooooooooooooooooooong")).gB( //indent:8 exp:8 + new InputIndentationCorrectIfAndParameter(), true)) //indent:8 exp:10,12 warn + || co(false, new //indent:8 exp:8 + SecondClassLongNam7(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 +} //indent:0 exp:0 + +class SecondClassLongNam7 { //indent:0 exp:0 + + public SecondClassLongNam7(String string) { //indent:2 exp:2 + + } //indent:2 exp:2 + + String getString(InputIndentationCorrectIfAndParameter instance, int integer) { //indent:2 exp:2 + return "String"; //indent:4 exp:4 + } //indent:2 exp:2 + + int getInteger(InputIndentationCorrectIfAndParameter instance, String string) { //indent:2 exp:2 + return -1; //indent:4 exp:4 + } //indent:2 exp:2 + + boolean gB(InputIndentationCorrectIfAndParameter instance,boolean flag){ //indent:2 exp:2 + return false; //indent:4 exp:4 + } //indent:2 exp:2 + + SecondClassLongNam7 getInstance() { //indent:2 exp:2 + return new SecondClassLongNam7("VeryLoooooooooo" //indent:4 exp:4 + + "oongString"); //indent:8 exp:8 + } //indent:2 exp:2 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines.java index da1130519a1..07bf53a5dfc 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines.java @@ -115,92 +115,3 @@ public String method() { //indent:4 exp:4 }; //indent:4 exp:4 } //indent:0 exp:0 - -@WrappedLinesAnnotation1 //indent:0 exp:0 -@WrappedLinesAnnotation4( //indent:0 exp:0 - { "value" } //indent:4 exp:4 -) //indent:0 exp:0 -@WrappedLinesAnnotation2 //indent:0 exp:0 -class InputIndentationCorrectMultipleAnnotationsWithWrappedLines6 { //indent:0 exp:0 - - @WrappedLinesAnnotation1 //indent:4 exp:4 - @WrappedLinesAnnotation4( //indent:4 exp:4 - { "value" } //indent:8 exp:8 - ) //indent:4 exp:4 - @WrappedLinesAnnotation2 //indent:4 exp:4 - public String value; //indent:4 exp:4 - - @WrappedLinesAnnotation1 //indent:4 exp:4 - @WrappedLinesAnnotation4( //indent:4 exp:4 - { "value" } //indent:8 exp:8 - ) //indent:4 exp:4 - @WrappedLinesAnnotation2 //indent:4 exp:4 - public String method() { //indent:4 exp:4 - return "value"; //indent:8 exp:8 - }; //indent:4 exp:4 - -} //indent:0 exp:0 - -@WrappedLinesAnnotation1 //indent:0 exp:0 -@WrappedLinesAnnotation4({ //indent:0 exp:0 - "value" //indent:4 exp:4 -}) //indent:0 exp:0 -@WrappedLinesAnnotation2 //indent:0 exp:0 -class InputIndentationCorrectMultipleAnnotationsWithWrappedLines7 { //indent:0 exp:0 - - @WrappedLinesAnnotation1 //indent:4 exp:4 - @WrappedLinesAnnotation4({ //indent:4 exp:4 - "value" //indent:8 exp:8 - }) //indent:4 exp:4 - @WrappedLinesAnnotation2 //indent:4 exp:4 - public String value; //indent:4 exp:4 - - @WrappedLinesAnnotation1 //indent:4 exp:4 - @WrappedLinesAnnotation4({ //indent:4 exp:4 - "value" //indent:8 exp:8 - }) //indent:4 exp:4 - @WrappedLinesAnnotation2 //indent:4 exp:4 - public String method() { //indent:4 exp:4 - return "value"; //indent:8 exp:8 - }; //indent:4 exp:4 - -} //indent:0 exp:0 - -@WrappedLinesAnnotation1 //indent:0 exp:0 -@WrappedLinesAnnotationOuter( //indent:0 exp:0 - @WrappedLinesAnnotationInner //indent:4 exp:4 -) //indent:0 exp:0 -@WrappedLinesAnnotation2 //indent:0 exp:0 -//indent:0 exp:0 -class InputIndentationCorrectMultipleAnnotationsWithWrappedLines8 { //indent:0 exp:0 - - @WrappedLinesAnnotation1 //indent:4 exp:4 - @WrappedLinesAnnotationOuter( //indent:4 exp:4 - @WrappedLinesAnnotationInner //indent:8 exp:8 - ) //indent:4 exp:4 - @WrappedLinesAnnotation2 //indent:4 exp:4 - public String value; //indent:4 exp:4 - - @WrappedLinesAnnotation1 //indent:4 exp:4 - @WrappedLinesAnnotationOuter( //indent:4 exp:4 - @WrappedLinesAnnotationInner //indent:8 exp:8 - ) //indent:4 exp:4 - @WrappedLinesAnnotation2 //indent:4 exp:4 - public String method() { //indent:4 exp:4 - return "value"; //indent:8 exp:8 - }; //indent:4 exp:4 - -} //indent:0 exp:0 - -@interface WrappedLinesAnnotation1 {} //indent:0 exp:0 -@interface WrappedLinesAnnotation2 {} //indent:0 exp:0 -@interface WrappedLinesAnnotation3 { //indent:0 exp:0 - String value(); //indent:4 exp:4 -} //indent:0 exp:0 -@interface WrappedLinesAnnotation4 { //indent:0 exp:0 - String[] value(); //indent:4 exp:4 -} //indent:0 exp:0 -@interface WrappedLinesAnnotationInner {} //indent:0 exp:0 -@interface WrappedLinesAnnotationOuter { //indent:0 exp:0 - WrappedLinesAnnotationInner[] value(); //indent:4 exp:4 -} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines1.java new file mode 100644 index 00000000000..df2f85996d0 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCorrectMultipleAnnotationsWithWrappedLines1.java @@ -0,0 +1,113 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + + +@WrappedLinesAnnotation1 //indent:0 exp:0 +@WrappedLinesAnnotation3( //indent:0 exp:0 + "value" //indent:4 exp:4 +) //indent:0 exp:0 +public class InputIndentationCorrectMultipleAnnotationsWithWrappedLines1 { //indent:0 exp:0 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotation3( //indent:4 exp:4 + "value" //indent:8 exp:8 + ) //indent:4 exp:4 + public String value; //indent:4 exp:4 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotation3( //indent:4 exp:4 + "value" //indent:8 exp:8 + ) //indent:4 exp:4 + public String method() { //indent:4 exp:4 + return "value"; //indent:8 exp:8 + }; //indent:4 exp:4 + +} //indent:0 exp:0 + +@WrappedLinesAnnotation1 //indent:0 exp:0 +@WrappedLinesAnnotation4( //indent:0 exp:0 + { "value" } //indent:4 exp:4 +) //indent:0 exp:0 +@WrappedLinesAnnotation2 //indent:0 exp:0 +class InputIndentationCorrectMultipleAnnotationsWithWrappedLines6 { //indent:0 exp:0 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotation4( //indent:4 exp:4 + { "value" } //indent:8 exp:8 + ) //indent:4 exp:4 + @WrappedLinesAnnotation2 //indent:4 exp:4 + public String value; //indent:4 exp:4 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotation4( //indent:4 exp:4 + { "value" } //indent:8 exp:8 + ) //indent:4 exp:4 + @WrappedLinesAnnotation2 //indent:4 exp:4 + public String method() { //indent:4 exp:4 + return "value"; //indent:8 exp:8 + }; //indent:4 exp:4 + +} //indent:0 exp:0 + +@WrappedLinesAnnotation1 //indent:0 exp:0 +@WrappedLinesAnnotation4({ //indent:0 exp:0 + "value" //indent:4 exp:4 +}) //indent:0 exp:0 +@WrappedLinesAnnotation2 //indent:0 exp:0 +class InputIndentationCorrectMultipleAnnotationsWithWrappedLines7 { //indent:0 exp:0 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotation4({ //indent:4 exp:4 + "value" //indent:8 exp:8 + }) //indent:4 exp:4 + @WrappedLinesAnnotation2 //indent:4 exp:4 + public String value; //indent:4 exp:4 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotation4({ //indent:4 exp:4 + "value" //indent:8 exp:8 + }) //indent:4 exp:4 + @WrappedLinesAnnotation2 //indent:4 exp:4 + public String method() { //indent:4 exp:4 + return "value"; //indent:8 exp:8 + }; //indent:4 exp:4 + +} //indent:0 exp:0 + +@WrappedLinesAnnotation1 //indent:0 exp:0 +@WrappedLinesAnnotationOuter( //indent:0 exp:0 + @WrappedLinesAnnotationInner //indent:4 exp:4 +) //indent:0 exp:0 +@WrappedLinesAnnotation2 //indent:0 exp:0 +//indent:0 exp:0 +class InputIndentationCorrectMultipleAnnotationsWithWrappedLines8 { //indent:0 exp:0 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotationOuter( //indent:4 exp:4 + @WrappedLinesAnnotationInner //indent:8 exp:8 + ) //indent:4 exp:4 + @WrappedLinesAnnotation2 //indent:4 exp:4 + public String value; //indent:4 exp:4 + + @WrappedLinesAnnotation1 //indent:4 exp:4 + @WrappedLinesAnnotationOuter( //indent:4 exp:4 + @WrappedLinesAnnotationInner //indent:8 exp:8 + ) //indent:4 exp:4 + @WrappedLinesAnnotation2 //indent:4 exp:4 + public String method() { //indent:4 exp:4 + return "value"; //indent:8 exp:8 + }; //indent:4 exp:4 + +} //indent:0 exp:0 + +@interface WrappedLinesAnnotation1 {} //indent:0 exp:0 +@interface WrappedLinesAnnotation2 {} //indent:0 exp:0 +@interface WrappedLinesAnnotation3 { //indent:0 exp:0 + String value(); //indent:4 exp:4 +} //indent:0 exp:0 +@interface WrappedLinesAnnotation4 { //indent:0 exp:0 + String[] value(); //indent:4 exp:4 +} //indent:0 exp:0 +@interface WrappedLinesAnnotationInner {} //indent:0 exp:0 +@interface WrappedLinesAnnotationOuter { //indent:0 exp:0 + WrappedLinesAnnotationInner[] value(); //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall.java index 6593d816938..160fb539fd5 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall.java @@ -77,53 +77,4 @@ public Invalid(InputIndentationCtorCall obj, double arg) { //indent:4 exp:4 } //indent:2 exp:2 - class Valid extends Base { //indent:2 exp:2 - - public Valid(int arg) { //indent:4 exp:4 - super( //indent:6 exp:6 - arg //indent:10 exp:10 - + 1L); //indent:12 exp:12 - } //indent:4 exp:4 - - public Valid(long arg) { //indent:4 exp:4 - new InputIndentationCtorCall().super( //indent:6 exp:6 - arg //indent:10 exp:10 - + 1L); //indent:12 exp:12 - } //indent:4 exp:4 - - public Valid() { //indent:4 exp:4 - this( //indent:6 exp:6 - 0L); //indent:10 exp:10 - } //indent:4 exp:4 - - public Valid(InputIndentationCtorCall obj, long arg) { //indent:4 exp:4 - obj.super( //indent:6 exp:6 - arg); //indent:10 exp:10 - } //indent:4 exp:4 - - public Valid(InputIndentationCtorCall obj, char arg) { //indent:4 exp:4 - obj.super( //indent:6 exp:6 - x -> arg); //indent:10 exp:10 - } //indent:4 exp:4 - - public Valid(InputIndentationCtorCall obj, int arg) { //indent:4 exp:4 - obj //indent:6 exp:6 - .super( //indent:10 exp:10 - arg); //indent:12 exp:12 - } //indent:4 exp:4 - - public Valid(InputIndentationCtorCall obj, float arg) { //indent:4 exp:4 - obj. //indent:6 exp:6 - super( //indent:10 exp:10 - x -> arg); //indent:14 exp:14 - } //indent:4 exp:4 - - public Valid(InputIndentationCtorCall obj, double arg) { //indent:4 exp:4 - obj. //indent:6 exp:6 - super( //indent:10 exp:10 - x -> arg); //indent:12 exp:12 - } //indent:4 exp:4 - - } //indent:2 exp:2 - } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall1.java new file mode 100644 index 00000000000..5ae410bf822 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCtorCall1.java @@ -0,0 +1,62 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationCtorCall1 extends InputIndentationCtorCall { //indent:0 exp:0 + + class Valid extends Base { //indent:2 exp:2 + + public Valid(int arg) { //indent:4 exp:4 + super( //indent:6 exp:6 + arg //indent:10 exp:10 + + 1L); //indent:12 exp:12 + } //indent:4 exp:4 + + public Valid(long arg) { //indent:4 exp:4 + new InputIndentationCtorCall().super( //indent:6 exp:6 + arg //indent:10 exp:10 + + 1L); //indent:12 exp:12 + } //indent:4 exp:4 + + public Valid() { //indent:4 exp:4 + this( //indent:6 exp:6 + 0L); //indent:10 exp:10 + } //indent:4 exp:4 + + public Valid(InputIndentationCtorCall obj, long arg) { //indent:4 exp:4 + obj.super( //indent:6 exp:6 + arg); //indent:10 exp:10 + } //indent:4 exp:4 + + public Valid(InputIndentationCtorCall obj, char arg) { //indent:4 exp:4 + obj.super( //indent:6 exp:6 + x -> arg); //indent:10 exp:10 + } //indent:4 exp:4 + + public Valid(InputIndentationCtorCall obj, int arg) { //indent:4 exp:4 + obj //indent:6 exp:6 + .super( //indent:10 exp:10 + arg); //indent:12 exp:12 + } //indent:4 exp:4 + + public Valid(InputIndentationCtorCall obj, float arg) { //indent:4 exp:4 + obj. //indent:6 exp:6 + super( //indent:10 exp:10 + x -> arg); //indent:14 exp:14 + } //indent:4 exp:4 + + public Valid(InputIndentationCtorCall obj, double arg) { //indent:4 exp:4 + obj. //indent:6 exp:6 + super( //indent:10 exp:10 + x -> arg); //indent:12 exp:12 + } //indent:4 exp:4 + + } //indent:2 exp:2 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation.java index 4e5da6fa45a..e125cd07dc2 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation.java @@ -90,68 +90,3 @@ public String toString() { //indent:8 exp:8 } //indent:8 exp:8 }.toString(); //indent:4 exp:4 } //indent:0 exp:0 - -@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 -@interface Multitude { String value(); } //indent:0 exp:0 - -@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 -@interface MetaConfig { //indent:0 exp:0 - - static class DevConfig { //indent:4 exp:4 - } //indent:4 exp:4 - - static class ProductionConfig { //indent:4 exp:4 - } //indent:4 exp:4 - Class[] classes() default { DevConfig.class, ProductionConfig.class }; //indent:4 exp:4 -} //indent:0 exp:0 - -@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 -@interface Multitudes { Multitude[] value(); } //indent:0 exp:0 - -@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) //indent:0 exp:0 -@interface Aclass { //indent:0 exp:0 - String b(); //indent:4 exp:4 - String[] c(); //indent:4 exp:4 -} //indent:0 exp:0 -class InnerAnnotSingleLine2 { //indent:0 exp:0 - @Retention(RetentionPolicy.SOURCE) @interface AnnotationOneLine {} //indent:5 exp:4 warn -} //indent:0 exp:0 -@interface RepeatableInner4 { //indent:0 exp:0 - public AnnotationWithTarget.AnnotationInnerLineWrap[] value(); //indent:4 exp:4 -} //indent:0 exp:0 -@interface HelloAnnot { //indent:0 exp:0 - public //indent:4 exp:4 - String myString() //indent:8 exp:8 - default "Hello"; //indent:8 exp:8 -} //indent:0 exp:0 -@ //indent:0 exp:0 - interface //indent:1 exp:0 warn -MyAnnotationWrapped { //indent:0 exp:0 - int value() default -1; //indent:4 exp:4 - AnnotationWithTarget.AnnotationInnerLineWrap field(); //indent:4 exp:4 -} //indent:0 exp:0 -@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 - @interface Marker {} //indent:11 exp:0 warn -@Target({ ElementType.METHOD, ElementType.TYPE_PARAMETER }) //indent:0 exp:0 -@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 - @interface FetchProfile { //indent:16 exp:0 warn - String name(); //indent:4 exp:4 - - FetchOverride[] fetchOverrides(); //indent:4 exp:4 - - @Target({ ElementType.TYPE, ElementType.METHOD }) //indent:4 exp:4 - @Retention(RetentionPolicy.RUNTIME) //indent:4 exp:4 - @interface FetchOverride { //indent:12 exp:4 warn - String association(); //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 - class FetchProfile2 { //indent:16 exp:0 warn - String name; //indent:4 exp:4 - - FetchOverride2[] fetchOverrides; //indent:4 exp:4 - - @Target({ ElementType.TYPE, ElementType.METHOD }) //indent:4 exp:4 - @interface FetchOverride2 { //indent:4 exp:4 - String association(); //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation1.java new file mode 100644 index 00000000000..e2ed7054b83 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationCustomAnnotation1.java @@ -0,0 +1,76 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.lang.annotation.ElementType; //indent:0 exp:0 +import java.lang.annotation.Retention; //indent:0 exp:0 +import java.lang.annotation.RetentionPolicy; //indent:0 exp:0 +import java.lang.annotation.Target; //indent:0 exp:0 + +public @interface InputIndentationCustomAnnotation1 { //indent:0 exp:0 + int value = 1; //indent:4 exp:4 + int value() default 0; //indent:4 exp:4 +} //indent:0 exp:0 + +@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 +@interface Multitude { String value(); } //indent:0 exp:0 + +@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 +@interface MetaConfig { //indent:0 exp:0 + + static class DevConfig { //indent:4 exp:4 + } //indent:4 exp:4 + + static class ProductionConfig { //indent:4 exp:4 + } //indent:4 exp:4 + Class[] classes() default { DevConfig.class, ProductionConfig.class }; //indent:4 exp:4 +} //indent:0 exp:0 + +@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 +@interface Multitudes { Multitude[] value(); } //indent:0 exp:0 + +@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) //indent:0 exp:0 +@interface Aclass { //indent:0 exp:0 + String b(); //indent:4 exp:4 + String[] c(); //indent:4 exp:4 +} //indent:0 exp:0 +class InnerAnnotSingleLine2 { //indent:0 exp:0 + @Retention(RetentionPolicy.SOURCE) @interface AnnotationOneLine {} //indent:5 exp:4 warn +} //indent:0 exp:0 +@interface RepeatableInner4 { //indent:0 exp:0 + public AnnotationWithTarget.AnnotationInnerLineWrap[] value(); //indent:4 exp:4 +} //indent:0 exp:0 +@interface HelloAnnot { //indent:0 exp:0 + public //indent:4 exp:4 + String myString() //indent:8 exp:8 + default "Hello"; //indent:8 exp:8 +} //indent:0 exp:0 +@ //indent:0 exp:0 + interface //indent:1 exp:0 warn +MyAnnotationWrapped { //indent:0 exp:0 + int value() default -1; //indent:4 exp:4 + AnnotationWithTarget.AnnotationInnerLineWrap field(); //indent:4 exp:4 +} //indent:0 exp:0 +@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 + @interface Marker {} //indent:11 exp:0 warn +@Target({ ElementType.METHOD, ElementType.TYPE_PARAMETER }) //indent:0 exp:0 +@Retention(RetentionPolicy.RUNTIME) //indent:0 exp:0 + @interface FetchProfile { //indent:16 exp:0 warn + String name(); //indent:4 exp:4 + + FetchOverride[] fetchOverrides(); //indent:4 exp:4 + + @Target({ ElementType.TYPE, ElementType.METHOD }) //indent:4 exp:4 + @Retention(RetentionPolicy.RUNTIME) //indent:4 exp:4 + @interface FetchOverride { //indent:12 exp:4 warn + String association(); //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 + class FetchProfile2 { //indent:16 exp:0 warn + String name; //indent:4 exp:4 + + FetchOverride2[] fetchOverrides; //indent:4 exp:4 + + @Target({ ElementType.TYPE, ElementType.METHOD }) //indent:4 exp:4 + @interface FetchOverride2 { //indent:4 exp:4 + String association(); //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava.java index 87334e2e92c..c54f8beac16 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava.java @@ -1,12 +1,9 @@ package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 import java.util.AbstractMap; //indent:0 exp:0 -import java.util.List; //indent:0 exp:0 import java.util.Set; //indent:0 exp:0 import java.util.concurrent.ConcurrentMap; //indent:0 exp:0 - - /** //indent:0 exp:0 * This test-input is intended to be checked using following configuration: //indent:1 exp:1 * //indent:1 exp:1 @@ -24,169 +21,6 @@ class InputIndentationFromGuava extends AbstractMap //indent:0 exp:0 implements ConcurrentMap { //indent:4 exp:4 - enum Strength { //indent:2 exp:2 - /* //indent:4 exp:4 - * (kevinb): If we ence the value and aren't loading, we needn't wrap the //indent:5 exp:5 - * value. This could sar entry. //indent:5 exp:5 - */ //indent:5 exp:5 - - STRONG { //indent:4 exp:4 - Object referenceValue( //indent:6 exp:6 - Segment s, ReferenceEntry entry, int value, int weight) { //indent:10 exp:>=10 - return (weight == 1) //indent:8 exp:8 - ? new StrongValueReference(value) //indent:12 exp:>=12 - : new WeightedStrongValueReference(value, weight); //indent:12 exp:>=12 - } //indent:6 exp:6 - - @Override //indent:6 exp:6 - List defaultEquivalence() { //indent:6 exp:6 - return new java.util.ArrayList<>(); //indent:8 exp:8 - } //indent:6 exp:6 - - @Override //indent:6 exp:6 - ValueReference referenceValue(Segment segment, //indent:5 exp:5 - ReferenceEntry entry, V value, int weight) { //indent:16 exp:>=10 - - return null; //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - - SOFT { //indent:4 exp:4 - Object referenceValue1( //indent:6 exp:6 - Segment s, ReferenceEntry en,int va,int we){ //indent:10 exp:>=10 - return (we == 1) //indent:8 exp:8 - ? new SoftValueReference(s.valueReferenceQueue, va, en) //indent:12 exp:>=12 - : new WeightedSoftValueReference(); //indent:12 exp:>=12 - } //indent:6 exp:6 - - @Override //indent:6 exp:6 - List defaultEquivalence() { //indent:6 exp:6 - return new java.util.ArrayList<>(); //indent:8 exp:8 - } //indent:6 exp:6 - - @Override Object referenceValue(Segment s, ReferenceEntry e, //indent:6 exp:6 - V value, int weight) //indent:16 exp:>=10 - { //indent:6 exp:6 - return null; //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - - WEAK { //indent:4 exp:4 - @Override //indent:6 exp:6 - Object referenceValue( //indent:6 exp:6 - Segment seg, ReferenceEntry entry, V value, int weight) { //indent:10 exp:>=10 - return (weight == 1) //indent:8 exp:8 - ? new WeakValueReference() //indent:12 exp:>=12 - : new WeightedWeakValueReference(); //indent:12 exp:>=12 - } //indent:6 exp:6 - - @Override //indent:6 exp:6 - List defaultEquivalence() { //indent:6 exp:6 - return new java.util.ArrayList<>(); //indent:8 exp:8 - } //indent:6 exp:6 - }; //indent:4 exp:4 - - /** //indent:4 exp:4 - * Creates a reference for the given value according to this value strength. //indent:5 exp:5 - */ //indent:5 exp:5 - abstract Object referenceValue( //indent:4 exp:4 - Segment segment, ReferenceEntry entry, V value, int weight); //indent:8 exp:>=8 - - /** //indent:4 exp:4 - * Returns the default equivalence stcompare and hash keys or values referenced //indent:5 exp:5 - * at this strength. This strategy wiss the user explicitly specifies an //indent:5 exp:5 - * alternate strategy. //indent:5 exp:5 - */ //indent:5 exp:5 - abstract List defaultEquivalence(); //indent:4 exp:4 - } //indent:2 exp:2 - - /** //indent:2 exp:2 - * Creates new entries. //indent:3 exp:3 - */ //indent:3 exp:3 - enum EntryFactory { //indent:2 exp:2 - STRONG { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - STRONG_ACCESS { //indent:4 exp:4 - StrongAccessEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongAccessEntry(k, h, next); //indent:8 exp:8 - } //indent:6 exp:6 - - ReferenceEntry copyEntry( //indent:6 exp:6 - Segment s, ReferenceEntry o, ReferenceEntry newT) { //indent:10 exp:>=10 - return newT; //indent:8 exp:8 - } //indent:6 exp:6 - {; //indent:6 exp:6 - } //indent:6 exp:6 - }, //indent:5 exp:5 - STRONG_WRITE { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - - ReferenceEntry copyEntry( //indent:6 exp:6 - Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 - return newN; //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - STRONG_ACCESS_WRITE { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - - ReferenceEntry copyEntry( //indent:6 exp:6 - Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 - return newN; //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - - WEAK { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - WEAK_ACCESS { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - - ReferenceEntry copyEntry( //indent:6 exp:6 - Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 - return newN; //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - WEAK_WRITE { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - - ReferenceEntry copyEntry( //indent:6 exp:6 - Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 - return newN; //indent:8 exp:8 - } //indent:6 exp:6 - }, //indent:4 exp:4 - WEAK_ACCESS_WRITE { //indent:4 exp:4 - StrongEntry newEntry( //indent:6 exp:6 - Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 - return new StrongEntry(); //indent:8 exp:8 - } //indent:6 exp:6 - - ReferenceEntry copyEntry( //indent:6 exp:6 - Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 - return newN; //indent:8 exp:8 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 - @Override //indent:2 exp:2 public Set> entrySet() //indent:2 exp:2 { //indent:2 exp:2 @@ -217,21 +51,21 @@ public V replace(K key, V value) //indent:2 exp:2 return null; //indent:4 exp:4 } //indent:2 exp:2 - private static class ValueReference { //indent:2 exp:2 + static class ValueReference { //indent:2 exp:2 } //indent:2 exp:2 - private static class ReferenceEntry { //indent:2 exp:2 + static class ReferenceEntry { //indent:2 exp:2 } //indent:2 exp:2 - private static class Segment { //indent:2 exp:2 + static class Segment { //indent:2 exp:2 protected Object valueReferenceQueue; //indent:4 exp:4 } //indent:2 exp:2 - private static class StrongAccessEntry { //indent:2 exp:2 + static class StrongAccessEntry { //indent:2 exp:2 public StrongAccessEntry(T1 key, int hash, ReferenceEntry next) //indent:4 exp:4 { //indent:4 exp:4 @@ -240,7 +74,7 @@ public StrongAccessEntry(T1 key, int hash, ReferenceEntry next) //indent } //indent:2 exp:2 - private static class StrongValueReference { //indent:2 exp:2 + static class StrongValueReference { //indent:2 exp:2 public StrongValueReference(int value) //indent:4 exp:4 { //indent:4 exp:4 @@ -249,7 +83,7 @@ public StrongValueReference(int value) //indent:4 exp:4 } //indent:2 exp:2 - private static class WeightedStrongValueReference { //indent:2 exp:2 + static class WeightedStrongValueReference { //indent:2 exp:2 public WeightedStrongValueReference(int value, int weight) //indent:4 exp:4 { //indent:4 exp:4 @@ -258,7 +92,7 @@ public WeightedStrongValueReference(int value, int weight) //indent:4 exp:4 } //indent:2 exp:2 - private static class SoftValueReference { //indent:2 exp:2 + static class SoftValueReference { //indent:2 exp:2 public SoftValueReference(Object valueReferenceQueue, int value, //indent:4 exp:4 ReferenceEntry entry) //indent:14 exp:>=8 @@ -268,23 +102,16 @@ public SoftValueReference(Object valueReferenceQueue, int value, //indent:4 exp: } //indent:2 exp:2 - private static class WeightedSoftValueReference { //indent:2 exp:2 + static class WeightedSoftValueReference { //indent:2 exp:2 } //indent:2 exp:2 - private static class WeakValueReference { //indent:2 exp:2 + static class WeakValueReference { //indent:2 exp:2 } //indent:2 exp:2 - private static class WeightedWeakValueReference { //indent:2 exp:2 - - } //indent:2 exp:2 - - private static class StrongEntry { //indent:2 exp:2 - - } //indent:2 exp:2 + static class WeightedWeakValueReference { //indent:2 exp:2 - public @interface XmlElement { //indent:2 exp:2 } //indent:2 exp:2 } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava1.java new file mode 100644 index 00000000000..24c68d44073 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava1.java @@ -0,0 +1,118 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.ReferenceEntry; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.Segment; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.SoftValueReference; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.StrongValueReference; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.ValueReference; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.WeakValueReference; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.WeightedSoftValueReference; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.WeightedStrongValueReference; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.WeightedWeakValueReference; //indent:8 exp:8 + +import java.util.List; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationFromGuava1 { //indent:0 exp:0 + + enum Strength { //indent:2 exp:2 + /* //indent:4 exp:4 + * (kevinb): If we ence the value and aren't loading, we needn't wrap the //indent:5 exp:5 + * value. This could sar entry. //indent:5 exp:5 + */ //indent:5 exp:5 + + STRONG { //indent:4 exp:4 + Object referenceValue( //indent:6 exp:6 + Segment s, ReferenceEntry entry, int value, int weight) { //indent:10 exp:>=10 + return (weight == 1) //indent:8 exp:8 + ? new StrongValueReference(value) //indent:12 exp:>=12 + : new WeightedStrongValueReference(value, weight); //indent:12 exp:>=12 + } //indent:6 exp:6 + + @Override //indent:6 exp:6 + List defaultEquivalence() { //indent:6 exp:6 + return new java.util.ArrayList<>(); //indent:8 exp:8 + } //indent:6 exp:6 + + @Override //indent:6 exp:6 + ValueReference referenceValue(Segment segment, //indent:5 exp:5 + ReferenceEntry entry, V value, int weight) { //indent:16 exp:>=10 + + return null; //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + + SOFT { //indent:4 exp:4 + Object referenceValue1( //indent:6 exp:6 + Segment s, ReferenceEntry en, //indent:10 exp:>=10 + int va, int we){ //indent:14 exp:14 + return (we == 1) //indent:8 exp:8 + ? new SoftValueReference(s.valueReferenceQueue, //indent:12 exp:>=12 + va, en) //indent:16 exp:16 + : new WeightedSoftValueReference(); //indent:12 exp:>=12 + } //indent:6 exp:6 + + @Override //indent:6 exp:6 + List defaultEquivalence() { //indent:6 exp:6 + return new java.util.ArrayList<>(); //indent:8 exp:8 + } //indent:6 exp:6 + + @Override Object referenceValue(Segment s, //indent:6 exp:6 + ReferenceEntry e, V value, int weight) //indent:16 exp:>=10 + { //indent:6 exp:6 + return null; //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + + WEAK { //indent:4 exp:4 + @Override //indent:6 exp:6 + Object referenceValue( //indent:6 exp:6 + Segment seg, ReferenceEntry entry, V value, int weight) { //indent:10 exp:>=10 + return (weight == 1) //indent:8 exp:8 + ? new WeakValueReference() //indent:12 exp:>=12 + : new WeightedWeakValueReference(); //indent:12 exp:>=12 + } //indent:6 exp:6 + + @Override //indent:6 exp:6 + List defaultEquivalence() { //indent:6 exp:6 + return new java.util.ArrayList<>(); //indent:8 exp:8 + } //indent:6 exp:6 + }; //indent:4 exp:4 + + /** //indent:4 exp:4 + * Creates a reference for the given value according to this value strength. //indent:5 exp:5 + */ //indent:5 exp:5 + abstract Object referenceValue( //indent:4 exp:4 + Segment segment, ReferenceEntry entry, V value, int weight); //indent:8 exp:>=8 + + /** //indent:4 exp:4 + * Returns the default equivalence stcompare and hash keys or values referenced //indent:5 exp:5 + * at this strength. This strategy wiss the user explicitly specifies an //indent:5 exp:5 + * alternate strategy. //indent:5 exp:5 + */ //indent:5 exp:5 + abstract List defaultEquivalence(); //indent:4 exp:4 + } //indent:2 exp:2 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava2.java index 039042d87f7..b74c011aa2f 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava2.java @@ -1,10 +1,11 @@ package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 -import java.util.Map; //indent:0 exp:0 -import java.util.Map.Entry; //indent:0 exp:0 - -import com.google.common.collect.Range; //indent:0 exp:0 -import com.google.common.collect.RangeMap; //indent:0 exp:0 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.ReferenceEntry; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.Segment; //indent:8 exp:8 +import static com.puppycrawl.tools.checkstyle.checks.indentation.indentation. //indent:0 exp:0 + InputIndentationFromGuava.StrongAccessEntry; //indent:8 exp:8 /** //indent:0 exp:0 * This test-input is intended to be checked using following configuration: //indent:1 exp:1 @@ -20,107 +21,100 @@ * //indent:1 exp:1 * //indent:1 exp:1 */ //indent:1 exp:1 -public abstract class InputIndentationFromGuava2, V> { //indent:0 exp:0 - - public InputIndentationFromGuava2 subRangeMap1(final Range range) { //indent:2 exp:2 - Range ranges = null; //indent:4 exp:4 - if (checkNotNull(range).isEmpty()) { //indent:4 exp:4 - } else if (ranges.isEmpty() || range.encloses(span())) { //indent:4 exp:4 - return this; //indent:6 exp:6 - } //indent:4 exp:4 - int lowerIndex = SortedLists.binarySearch(); //indent:4 exp:4 - int upperIndex = SortedLists.binarySearch(); //indent:4 exp:4 - if (lowerIndex >= upperIndex) { //indent:4 exp:4 - return null; //indent:6 exp:6 - } //indent:4 exp:4 - final int off = lowerIndex; //indent:4 exp:4 - final int len = upperIndex - lowerIndex; //indent:4 exp:4 - InputIndentationFromGuava2 outer = null; //indent:4 exp:4 - return outer; //indent:4 exp:4 - } //indent:2 exp:2 - - public V get(int index) { //indent:2 exp:2 - K key = null; //indent:4 exp:4 - int len = 0; //indent:4 exp:4 - checkElementIndex(index, len); //indent:4 exp:4 - int off; //indent:4 exp:4 - RangeMap ranges = null; //indent:4 exp:4 - if (index == 0 || index == len - 1) { //indent:4 exp:4 - Object range; //indent:6 exp:6 - return ranges.get(key); //indent:6 exp:6 - } else { //indent:4 exp:4 - return ranges.get(key); //indent:6 exp:6 - } //indent:4 exp:4 +public class InputIndentationFromGuava2 { //indent:0 exp:0 + + /** //indent:2 exp:2 + * Creates new entries. //indent:3 exp:3 + */ //indent:3 exp:3 + enum EntryFactory { //indent:2 exp:2 + STRONG { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + STRONG_ACCESS { //indent:4 exp:4 + StrongAccessEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongAccessEntry(k, h, next); //indent:8 exp:8 + } //indent:6 exp:6 + + ReferenceEntry copyEntry( //indent:6 exp:6 + Segment s, ReferenceEntry o, ReferenceEntry newT) { //indent:10 exp:>=10 + return newT; //indent:8 exp:8 + } //indent:6 exp:6 + {; //indent:6 exp:6 + } //indent:6 exp:6 + }, //indent:5 exp:5 + STRONG_WRITE { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + + ReferenceEntry copyEntry( //indent:6 exp:6 + Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 + return newN; //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + STRONG_ACCESS_WRITE { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + + ReferenceEntry copyEntry( //indent:6 exp:6 + Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 + return newN; //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + + WEAK { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + WEAK_ACCESS { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + + ReferenceEntry copyEntry( //indent:6 exp:6 + Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 + return newN; //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + WEAK_WRITE { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + + ReferenceEntry copyEntry( //indent:6 exp:6 + Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 + return newN; //indent:8 exp:8 + } //indent:6 exp:6 + }, //indent:4 exp:4 + WEAK_ACCESS_WRITE { //indent:4 exp:4 + StrongEntry newEntry( //indent:6 exp:6 + Segment s, K k, int h, @XmlElement ReferenceEntry next) { //indent:10 exp:>=10 + return new StrongEntry(); //indent:8 exp:8 + } //indent:6 exp:6 + + ReferenceEntry copyEntry( //indent:6 exp:6 + Segment s, ReferenceEntry o, ReferenceEntry newN) { //indent:10 exp:>=10 + return newN; //indent:8 exp:8 + } //indent:6 exp:6 + }; //indent:4 exp:4 } //indent:2 exp:2 - private void checkElementIndex(int index, Object len) //indent:2 exp:2 - { //indent:2 exp:2 - - } //indent:2 exp:2 - - boolean isPartialView() { //indent:2 exp:2 - return true; //indent:4 exp:4 - } //indent:2 exp:2 + private static class StrongEntry { //indent:2 exp:2 - private Range checkNotNull(Range range) //indent:2 exp:2 - { //indent:2 exp:2 - return null; //indent:4 exp:4 } //indent:2 exp:2 - @Deprecated //indent:2 exp:2 - public V get(K key) //indent:2 exp:2 - { //indent:2 exp:2 - return null; //indent:4 exp:4 + public @interface XmlElement { //indent:2 exp:2 } //indent:2 exp:2 - public Range span() //indent:2 exp:2 - { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public void put(Range range, V value) //indent:2 exp:2 - { //indent:2 exp:2 - - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public void putAll(RangeMap rangeMap) //indent:2 exp:2 - { //indent:2 exp:2 - - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public void clear() //indent:2 exp:2 - { //indent:2 exp:2 - - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public void remove(Range range) //indent:2 exp:2 - { //indent:2 exp:2 - - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public Map, V> asMapOfRanges() //indent:2 exp:2 - { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public RangeMap subRangeMap(Range range) //indent:2 exp:2 - { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 - - @Deprecated //indent:2 exp:2 - public Entry, V> getEntry(K key) //indent:2 exp:2 - { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 - - private static class SortedLists { //indent:2 exp:2 - public static int binarySearch() { return 4; } //indent:4 exp:4 - } //indent:2 exp:2 } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava3.java new file mode 100644 index 00000000000..94d459e1055 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava3.java @@ -0,0 +1,116 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.util.Map; //indent:0 exp:0 +import java.util.Map.Entry; //indent:0 exp:0 + +import com.google.common.collect.Range; //indent:0 exp:0 +import com.google.common.collect.RangeMap; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public abstract class InputIndentationFromGuava3, V> { //indent:0 exp:0 + + public InputIndentationFromGuava3 subRangeMap1(final Range range) { //indent:2 exp:2 + Range ranges = null; //indent:4 exp:4 + if (checkNotNull(range).isEmpty()) { //indent:4 exp:4 + } else if (ranges.isEmpty() || range.encloses(span())) { //indent:4 exp:4 + return this; //indent:6 exp:6 + } //indent:4 exp:4 + int lowerIndex = SortedLists.binarySearch(); //indent:4 exp:4 + int upperIndex = SortedLists.binarySearch(); //indent:4 exp:4 + if (lowerIndex >= upperIndex) { //indent:4 exp:4 + return null; //indent:6 exp:6 + } //indent:4 exp:4 + final int off = lowerIndex; //indent:4 exp:4 + final int len = upperIndex - lowerIndex; //indent:4 exp:4 + InputIndentationFromGuava3 outer = null; //indent:4 exp:4 + return outer; //indent:4 exp:4 + } //indent:2 exp:2 + + public V get(int index) { //indent:2 exp:2 + K key = null; //indent:4 exp:4 + int len = 0; //indent:4 exp:4 + checkElementIndex(index, len); //indent:4 exp:4 + int off; //indent:4 exp:4 + RangeMap ranges = null; //indent:4 exp:4 + if (index == 0 || index == len - 1) { //indent:4 exp:4 + Object range; //indent:6 exp:6 + return ranges.get(key); //indent:6 exp:6 + } else { //indent:4 exp:4 + return ranges.get(key); //indent:6 exp:6 + } //indent:4 exp:4 + } //indent:2 exp:2 + + private void checkElementIndex(int index, Object len) //indent:2 exp:2 + { //indent:2 exp:2 + + } //indent:2 exp:2 + + private Range checkNotNull(Range range) //indent:2 exp:2 + { //indent:2 exp:2 + return null; //indent:4 exp:4 + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public V get(K key) //indent:2 exp:2 + { //indent:2 exp:2 + return null; //indent:4 exp:4 + } //indent:2 exp:2 + + public Range span() //indent:2 exp:2 + { //indent:2 exp:2 + return null; //indent:4 exp:4 + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public void put(Range range, V value) //indent:2 exp:2 + { //indent:2 exp:2 + + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public void putAll(RangeMap rangeMap) //indent:2 exp:2 + { //indent:2 exp:2 + + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public void remove(Range range) //indent:2 exp:2 + { //indent:2 exp:2 + + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public Map, V> asMapOfRanges() //indent:2 exp:2 + { //indent:2 exp:2 + return null; //indent:4 exp:4 + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public RangeMap subRangeMap(Range range) //indent:2 exp:2 + { //indent:2 exp:2 + return null; //indent:4 exp:4 + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public Entry, V> getEntry(K key) //indent:2 exp:2 + { //indent:2 exp:2 + return null; //indent:4 exp:4 + } //indent:2 exp:2 + + private static class SortedLists { //indent:2 exp:2 + public static int binarySearch() { return 4; } //indent:4 exp:4 + } //indent:2 exp:2 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava4.java new file mode 100644 index 00000000000..ad50826cfd7 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationFromGuava4.java @@ -0,0 +1,29 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationFromGuava4 { //indent:0 exp:0 + + boolean isPartialView() { //indent:2 exp:2 + return true; //indent:4 exp:4 + } //indent:2 exp:2 + + @Deprecated //indent:2 exp:2 + public void clear() //indent:2 exp:2 + { //indent:2 exp:2 + + } //indent:2 exp:2 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent.java index 9a202a1d1d0..cefa9103e9e 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent.java @@ -16,121 +16,64 @@ */ //indent:1 exp:1 public class InputIndentationInvalidArrayInitIndent { //indent:0 exp:0 - int[] array = new int[] {1, 2, 3}; + int[] array = new int[] {1, 2, 3}; //indent:4 exp:4 - int[] arrayb = new int[] {1, 2, 3}; - int[] arrayc = new int[] {1, 2, 3}; + int[] arrayb = new int[] {1, 2, 3}; //indent:2 exp:4 warn + int[] arrayc = new int[] {1, 2, 3}; //indent:6 exp:4 warn - int[] array2 = new int[] { - 1, 2, 3 - }; + int[] array2 = new int[] { //indent:2 exp:4 warn + 1, 2, 3 //indent:6 exp:6 + }; //indent:6 exp:6 - int[] array2b = new int[] { - 1, 2, 3 - }; + int[] array2b = new int[] { //indent:6 exp:4 warn + 1, 2, 3 //indent:8 exp:10,34,36 warn + }; //indent:4 exp:6,10 warn - int[] array3 = new int[] { - 1, - 2, - 3 - }; + int[] array3 = new int[] { //indent:4 exp:4 + 1, //indent:9 exp:8,31,33 warn + 2, //indent:7 exp:8,31,33 warn + 3 //indent:9 exp:8,31,33 warn + }; //indent:4 exp:4 - int[] array4 = new int[] - { - 1, - 2, - 3 - }; + int[] array4 = new int[] //indent:4 exp:4 + { //indent:2 exp:4,8 warn + 1, //indent:8 exp:8 + 2, //indent:8 exp:8 + 3 //indent:8 exp:8 + }; //indent:6 exp:4,8 warn - int[] array5 = new int[] - {1, 2, 3}; + int[] array5 = new int[] //indent:4 exp:4 + {1, 2, 3}; //indent:2 exp:4,8 warn - int[] array6 = new int[] { 1, 2, - 3, - 4,}; + int[] array6 = new int[] { 1, 2, //indent:4 exp:4 + 3, //indent:20 exp:8,31,33 warn + 4,}; //indent:4 exp:8,31,33 warn - int[] array7 = new int[] { - 1, 2, - 3 - }; + int[] array7 = new int[] { //indent:4 exp:4 + 1, 2, //indent:6 exp:8,31,33 warn + 3 //indent:8 exp:8 + }; //indent:4 exp:4 - int[] array8 = new int[] { }; + int[] array8 = new int[] { }; //indent:2 exp:4 warn - int[] array9 = new int[] { - }; + int[] array9 = new int[] { //indent:6 exp:4 warn + }; //indent:2 exp:6,10 warn - int[][] array10 = new int[][] { - new int[] { 1, 2, 3}, - new int[] { 1, 2, 3}, - }; + int[][] array10 = new int[][] { //indent:4 exp:4 + new int[] { 1, 2, 3}, //indent:6 exp:8,36,38 warn + new int[] { 1, 2, 3}, //indent:8 exp:8 + }; //indent:4 exp:4 - int[][] array10b - = new int[][] { - new int[] { 1, 2, 3}, - new int[] { 1, 2, 3}, - }; - - private void func1(int[] arg) { - - } - - - /** Creates a new instance of InputIndentationValidArrayInitIndent */ - public InputIndentationInvalidArrayInitIndent() { - - func1(new int[] { - 1, 2, 3 - }); - } - - private static char[] sHexChars = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - private void myFunc3() - { - char[] sHexChars2 = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - char[] sHexChars3 = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' - }; - - char[] sHexChars4 = - { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' - }; - - } - interface SomeInterface1 { - @interface SomeAnnotation1 { - String[] values(); - String[] description() default ""; - String[] description2() default { "hello", - "checkstyle"}; - } - @SomeAnnotation1(values = - { - "hello", - "checkstyle" - }, - description = { "hello", - "checkstyle" - }, - description2 = { - "hello", "chekstyle" - } - ) - void worked(); - } -} + int[][] array10b //indent:4 exp:4 + = new int[][] { //indent:8 exp:8 + new int[] { 1, 2, 3}, //indent:10 exp:12,24,26 warn + new int[] { 1, 2, 3}, //indent:12 exp:12 + }; //indent:8 exp:8 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent1.java new file mode 100644 index 00000000000..1b977f678f6 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndent1.java @@ -0,0 +1,75 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationInvalidArrayInitIndent1 { //indent:0 exp:0 + + private void func1(int[] arg) { //indent:4 exp:4 + + } //indent:4 exp:4 + + + /** Creates a new instance of InputIndentationValidArrayInitIndent */ //indent:4 exp:4 + public InputIndentationInvalidArrayInitIndent1() { //indent:4 exp:4 + + func1(new int[] { //indent:8 exp:8 + 1, 2, 3 //indent:8 exp:12 warn + }); //indent:8 exp:8 + } //indent:4 exp:4 + + private static char[] sHexChars = { //indent:4 exp:4 + '0', '1', '2', '3', '4', '5', '6', '7', //indent:8 exp:8 + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; //indent:8 exp:8 + + private void myFunc3() //indent:4 exp:4 + { //indent:4 exp:4 + char[] sHexChars2 = { //indent:8 exp:8 + '0', '1', '2', '3', '4', '5', '6', '7', //indent:10 exp:12,30,32 warn + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; //indent:14 exp:12,30,32 warn + + char[] sHexChars3 = { //indent:8 exp:8 + '0', '1', '2', '3', '4', '5', '6', '7', //indent:10 exp:12,31,32 warn + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' //indent:14 exp:12,31,32 warn + }; //indent:6 exp:8,12 warn + + char[] sHexChars4 = //indent:8 exp:8 + { //indent:6 exp:8,12 warn + '0', '1', '2', '3', '4', '5', '6', '7', //indent:14 exp:8,10,12 warn + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' //indent:10 exp:10 + }; //indent:6 exp:8,12 warn + + } //indent:4 exp:4 + interface SomeInterface1 { //indent:4 exp:4 + @interface SomeAnnotation1 { //indent:8 exp:8 + String[] values(); //indent:12 exp:12 + String[] description() default ""; //indent:12 exp:12 + String[] description2() default { "hello", //indent:12 exp:12 + "checkstyle"}; //indent:12 exp:16,46,48 warn + } //indent:8 exp:8 + @SomeInterface1.SomeAnnotation1(values = //indent:8 exp:8 + { //indent:12 exp:12 + "hello", //indent:14 exp:14 + "checkstyle" //indent:12 exp:12 + }, //indent:12 exp:12 + description = { "hello", //indent:12 exp:12 + "checkstyle" //indent:14 exp:16,28,30 warn + }, //indent:8 exp:12,16 warn + description2 = { //indent:12 exp:12 + "hello", "chekstyle" //indent:12 exp:16,29,31 warn + } //indent:12 exp:12 + ) //indent:8 exp:8 + void worked(); //indent:6 exp:6 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndentWithoutTrailingComments.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndentWithoutTrailingComments.java new file mode 100644 index 00000000000..7083c093a9a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidArrayInitIndentWithoutTrailingComments.java @@ -0,0 +1,44 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; + +/** + * This test-input is intended to be checked using following configuration: + * + * arrayInitIndent = 4 + * basicOffset = 4 + * braceAdjustment = 0 + * caseIndent = 4 + * forceStrictCondition = (default) false + * lineWrappingIndentation = 4 + * tabWidth = 4 + * throwsIndent = 4 + * + * + */ +public class InputIndentationInvalidArrayInitIndentWithoutTrailingComments { + + int[] array1 = new int[] + { + + }; + interface SomeInterface1 { + @interface SomeAnnotation1 { + String[] values(); + String[] description() default ""; + String[] description2() default { "hello", + "checkstyle"}; + } + @SomeInterface1.SomeAnnotation1(values = + { + "hello", + "checkstyle" + }, + description = { "hello", + "checkstyle" + }, + description2 = { + "hello", "chekstyle" + } + ) + void worked(); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent.java index fe557beda6a..57a7fbffb9b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent.java @@ -88,66 +88,4 @@ public void method1() { //indent:4 exp:4 } //indent:4 exp:4 - -// static init at beginning of line is broken for now //indent:0 exp:0 - - - static { int var = 4; } //indent:2 exp:4 warn - static { int var = 4; } //indent:6 exp:4 warn - - - static { //indent:4 exp:4 - int var = 4; //indent:7 exp:8 warn - } //indent:4 exp:4 - - static { //indent:6 exp:4 warn - int var = 4; //indent:8 exp:8 - } //indent:2 exp:4 warn - - static { //indent:2 exp:4 warn - int var = 4; //indent:8 exp:8 - } //indent:6 exp:4 warn - - static //indent:2 exp:4 warn - { //indent:4 exp:4 - int var = 4; //indent:6 exp:8 warn - } //indent:4 exp:4 - static //indent:4 exp:4 - { //indent:2 exp:4 warn - int var = 4; //indent:6 exp:8 warn - } //indent:6 exp:4 warn - - - static //indent:4 exp:4 - { //indent:4 exp:4 - int var = 4; //indent:6 exp:8 warn - } //indent:4 exp:4 - - static //indent:4 exp:4 - { //indent:4 exp:4 - int var = 4; //indent:4 exp:8 warn - } //indent:2 exp:4 warn - - static //indent:4 exp:4 - { //indent:4 exp:4 - int var = 4; //indent:8 exp:8 - } //indent:6 exp:4 warn - - - { int var = 4; } //indent:2 exp:4 warn - { int var = 4; } //indent:6 exp:4 warn - - - { //indent:2 exp:4 warn - int var = 4; //indent:8 exp:8 - } //indent:6 exp:4 warn - - { //indent:6 exp:4 warn - int var = 4; //indent:8 exp:8 - } //indent:2 exp:4 warn - - { //indent:4 exp:4 - int var = 4; //indent:6 exp:8 warn - } //indent:4 exp:4 - } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent1.java new file mode 100644 index 00000000000..264fb0dabb1 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidBlockIndent1.java @@ -0,0 +1,85 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationInvalidBlockIndent1 { //indent:0 exp:0 + + /** Creates a new instance of InputValidBlockIndent */ //indent:4 exp:4 + public InputIndentationInvalidBlockIndent1() { //indent:4 exp:4 + } //indent:4 exp:4 + + +// static init at beginning of line is broken for now //indent:0 exp:0 + + + static { int var = 4; } //indent:2 exp:4 warn + static { int var = 4; } //indent:6 exp:4 warn + + + static { //indent:4 exp:4 + int var = 4; //indent:7 exp:8 warn + } //indent:4 exp:4 + + static { //indent:6 exp:4 warn + int var = 4; //indent:8 exp:8 + } //indent:2 exp:4 warn + + static { //indent:2 exp:4 warn + int var = 4; //indent:8 exp:8 + } //indent:6 exp:4 warn + + static //indent:2 exp:4 warn + { //indent:4 exp:4 + int var = 4; //indent:6 exp:8 warn + } //indent:4 exp:4 + static //indent:4 exp:4 + { //indent:2 exp:4 warn + int var = 4; //indent:6 exp:8 warn + } //indent:6 exp:4 warn + + + static //indent:4 exp:4 + { //indent:4 exp:4 + int var = 4; //indent:6 exp:8 warn + } //indent:4 exp:4 + + static //indent:4 exp:4 + { //indent:4 exp:4 + int var = 4; //indent:4 exp:8 warn + } //indent:2 exp:4 warn + + static //indent:4 exp:4 + { //indent:4 exp:4 + int var = 4; //indent:8 exp:8 + } //indent:6 exp:4 warn + + + { int var = 4; } //indent:2 exp:4 warn + { int var = 4; } //indent:6 exp:4 warn + + + { //indent:2 exp:4 warn + int var = 4; //indent:8 exp:8 + } //indent:6 exp:4 warn + + { //indent:6 exp:4 warn + int var = 4; //indent:8 exp:8 + } //indent:2 exp:4 warn + + { //indent:4 exp:4 + int var = 4; //indent:6 exp:8 warn + } //indent:4 exp:4 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent.java index 834378715a9..20fcdbdf657 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent.java @@ -1,9 +1,5 @@ package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 -import java.awt.event.ActionEvent; //indent:0 exp:0 -import java.awt.event.ActionListener; //indent:0 exp:0 - -import javax.swing.JButton; //indent:0 exp:0 /** //indent:0 exp:0 * This test-input is intended to be checked using following configuration: //indent:1 exp:1 @@ -79,111 +75,6 @@ class InputIndentationInvalidClassDefIndentc2 //indent:0 exp:0 } //indent:0 exp:0 - - -final class InputIndentationValidClassDefIndent66 extends Object { //indent:0 exp:0 - - class foo { } //indent:2 exp:4 warn - - class fooBS { } //indent:6 exp:4 warn - - - class foo2 { public int x; } //indent:2 exp:4 warn - - - class foo3 { //indent:4 exp:4 - public //indent:6 exp:8 warn - int x; //indent:12 exp:>=10 - } //indent:4 exp:4 - - class foo3b { //indent:4 exp:4 - public //indent:8 exp:8 - int x; //indent:10 exp:>=12 warn - } //indent:4 exp:4 - - - class foo4 { //indent:4 exp:4 - public int x; //indent:6 exp:8 warn - } //indent:4 exp:4 - - class foo4c { //indent:4 exp:4 - public int x; //indent:8 exp:8 - } //indent:6 exp:4 warn - - class foo4b { //indent:6 exp:4 warn - public int x; //indent:8 exp:8 - } //indent:4 exp:4 - - - private void myMethod() { //indent:4 exp:4 - class localFoo { //indent:6 exp:8 warn - - } //indent:8 exp:8 - class localFoo1 { //indent:10 exp:8 warn - - } //indent:10 exp:8 warn - - class localFoo2 { //indent:8 exp:8 - int x; //indent:10 exp:12 warn - - int func() { return 3; } //indent:12 exp:12 - } //indent:8 exp:8 - - new JButton().addActionListener(new ActionListener() //indent:10 exp:8 warn - { //indent:8 exp:10,14 warn - public void actionPerformed(ActionEvent e) { //indent:12 exp:12 - - } //indent:12 exp:12 - }); //indent:8 exp:10,14 warn - - - new JButton().addActionListener(new ActionListener() //indent:8 exp:8 - { //indent:6 exp:8,12 warn - public void actionPerformed(ActionEvent e) { //indent:12 exp:12 - - } //indent:12 exp:12 - }); //indent:6 exp:8,12 warn - - - new JButton().addActionListener(new ActionListener() //indent:8 exp:8 - { //indent:8 exp:8,12 - public void actionPerformed(ActionEvent e) { //indent:10 exp:12 warn - - } //indent:10 exp:12 warn - }); //indent:8 exp:8,12 - - - new JButton().addActionListener(new ActionListener() { //indent:8 exp:8 - public void actionPerformed(ActionEvent e) { //indent:12 exp:12 - int i = 2; //indent:16 exp:16 - } //indent:12 exp:12 - }); //indent:8 exp:8,12 - - Object o = new ActionListener() //indent:8 exp:8 - { //indent:8 exp:8,12 - public void actionPerformed(ActionEvent e) { //indent:12 exp:12 - - } //indent:12 exp:12 - }; //indent:8 exp:8,12 - - myfunc2(10, 10, 10, //indent:8 exp:8 - myfunc3(11, 11, //indent:12 exp:>=12 - 11, 11), //indent:16 exp:>=16 - 10, 10, //indent:12 exp:>=12 - 10); //indent:12 exp:>=12 - - - } //indent:4 exp:4 - - private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4 - } //indent:4 exp:4 - - private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4 - return 1; //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 - - final //indent:0 exp:0 class InputIndentationValidClassDefIndent4d //indent:0 exp:4 warn extends //indent:4 exp:4 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent1.java new file mode 100644 index 00000000000..40a4f675000 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidClassDefIndent1.java @@ -0,0 +1,117 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.awt.event.ActionEvent; //indent:0 exp:0 +import java.awt.event.ActionListener; //indent:0 exp:0 + +import javax.swing.JButton; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 + public class InputIndentationInvalidClassDefIndent1 extends Object { //indent:2 exp:0 warn +} //indent:0 exp:0 + +final class InputIndentationValidClassDefIndent66 extends Object { //indent:0 exp:0 + + class foo { } //indent:2 exp:4 warn + + class fooBS { } //indent:6 exp:4 warn + + class foo2 { public int x; } //indent:2 exp:4 warn + + class foo3 { //indent:4 exp:4 + public //indent:6 exp:8 warn + int x; //indent:12 exp:>=10 + } //indent:4 exp:4 + + class foo3b { //indent:4 exp:4 + public //indent:8 exp:8 + int x; //indent:10 exp:>=12 warn + } //indent:4 exp:4 + + class foo4 { //indent:4 exp:4 + public int x; //indent:6 exp:8 warn + } //indent:4 exp:4 + + class foo4c { //indent:4 exp:4 + public int x; //indent:8 exp:8 + } //indent:6 exp:4 warn + + class foo4b { //indent:6 exp:4 warn + public int x; //indent:8 exp:8 + } //indent:4 exp:4 + + private void myMethod() { //indent:4 exp:4 + class localFoo { //indent:6 exp:8 warn + + } //indent:8 exp:8 + class localFoo1 { //indent:10 exp:8 warn + + } //indent:10 exp:8 warn + + class localFoo2 { //indent:8 exp:8 + int x; //indent:10 exp:12 warn + + int func() { return 3; } //indent:12 exp:12 + } //indent:8 exp:8 + + new JButton().addActionListener(new ActionListener() //indent:10 exp:8 warn + { //indent:8 exp:10,14 warn + public void actionPerformed(ActionEvent e) { //indent:12 exp:12 + + } //indent:12 exp:12 + }); //indent:8 exp:10,14 warn + + new JButton().addActionListener(new ActionListener() //indent:8 exp:8 + { //indent:6 exp:8,12 warn + public void actionPerformed(ActionEvent e) { //indent:12 exp:12 + + } //indent:12 exp:12 + }); //indent:6 exp:8,12 warn + + new JButton().addActionListener(new ActionListener() //indent:8 exp:8 + { //indent:8 exp:8,12 + public void actionPerformed(ActionEvent e) { //indent:10 exp:12 warn + + } //indent:10 exp:12 warn + }); //indent:8 exp:8,12 + + new JButton().addActionListener(new ActionListener() { //indent:8 exp:8 + public void actionPerformed(ActionEvent e) { //indent:12 exp:12 + int i = 2; //indent:16 exp:16 + } //indent:12 exp:12 + }); //indent:8 exp:8,12 + + Object o = new ActionListener() //indent:8 exp:8 + { //indent:8 exp:8,12 + public void actionPerformed(ActionEvent e) { //indent:12 exp:12 + + } //indent:12 exp:12 + }; //indent:8 exp:8,12 + + myfunc2(10, 10, 10, //indent:8 exp:8 + myfunc3(11, 11, //indent:12 exp:>=12 + 11, 11), //indent:16 exp:>=16 + 10, 10, //indent:12 exp:>=12 + 10); //indent:12 exp:>=12 + + } //indent:4 exp:4 + + private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4 + } //indent:4 exp:4 + + private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4 + return 1; //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent.java index 74c9a2e011c..084aeeba1c9 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent.java @@ -106,162 +106,4 @@ public void emptyIfTest() //indent:4 exp:4 } //indent:11 exp:8 warn } //indent:4 exp:4 - ///// same as above, with statements //indent:4 exp:4 - public void populatedIfTest() //indent:4 exp:4 - { //indent:4 exp:4 - boolean test = false; //indent:8 exp:8 - // no braces if //indent:8 exp:8 - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:14 exp:>=12 - - // no braces if/else //indent:8 exp:8 - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:>=12 - else //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:>=12 - - - // lcurly on same line, and stmt //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:14 exp:12 warn - } //indent:8 exp:8 - - // lcurly on next line and stmt //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:10 exp:8 warn - System.getProperty("blah"); //indent:10 exp:12 warn - } //indent:8 exp:8 - // lcurly for if and else on same line //indent:8 exp:8 - if (test) { //indent:8 exp:8 - - System. //indent:14 exp:12 warn - getProperty("blah"); //indent:10 exp:12 warn - } else { //indent:8 exp:8 - System. //indent:10 exp:12 warn - getProperty("blah"); //indent:8 exp:12 warn - } //indent:8 exp:8 - - // lcurly for if and else on same line //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - System.getProperty("blah"); //indent:16 exp:12 warn - } //indent:9 exp:8 warn - else //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:16 exp:12 warn - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 - if (test) { //indent:8 exp:8 -System.getProperty("blah"); //indent:0 exp:12 warn - } //indent:8 exp:8 - else //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:40 exp:12 warn - } //indent:8 exp:8 - - - // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:14 exp:12 warn - } else //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:14 exp:12 warn - } //indent:8 exp:8 - - // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:10 exp:12 warn - } else { //indent:8 exp:8 - System.getProperty("blah"); //indent:10 exp:12 warn - } //indent:8 exp:8 - - // lcurly for if and else on same line -- mixed braces, unnested //indent:8 exp:8 - if (test) { //indent:10 exp:8 warn - System.getProperty("blah"); //indent:14 exp:12 warn - } //indent:10 exp:8 warn - else { //indent:10 exp:8 warn - System.getProperty("blah"); //indent:14 exp:12 warn - } //indent:10 exp:8 warn - - if (test //indent:8 exp:8 - && 7 < 8 && 8 < 9 //indent:9 exp:12 warn - && 10 < 11) { //indent:11 exp:12 warn - } //indent:8 exp:8 - - if (test) //indent:8 exp:8 - return; //indent:10 exp:12 warn - - if (test) { //indent:8 exp:8 - } else if (7 < 8) { //indent:7 exp:8 warn - } else if (8 < 9) { //indent:8 exp:8 - } //indent:8 exp:8 - - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:>=12 - } else if (7 < 8) { //indent:8 exp:8 - System.getProperty("blah"); //indent:10 exp:>=12 warn - } else if (8 < 9) { //indent:8 exp:8 - System.getProperty("blah"); //indent:10 exp:>=12 warn - } //indent:8 exp:8 - - - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - else if (7 < 8) //indent:8 exp:8 - System.getProperty("blah"); //indent:10 exp:12 warn - else if (8 < 9) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - - - // //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else //indent:8 exp:8 - if (7 < 8) { //indent:10 exp:12 warn - System.getProperty("blah"); //indent:16 exp:16 - } else //indent:12 exp:12 - if (8 < 9) { //indent:16 exp:16 - System.getProperty("blah"); //indent:18 exp:20 warn - } //indent:16 exp:16 - - if (test) { //indent:8 exp:8 - System.getProperty("blah"); } //indent:12 exp:12 - } //indent:4 exp:4 - - public void parenIfTest() { //indent:4 exp:4 - boolean test = true; //indent:8 exp:8 - - if (test //indent:8 exp:8 - ) { //indent:10 exp:8 warn - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - if (test //indent:8 exp:8 - ) //indent:6 exp:8 warn - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - if //indent:8 exp:8 - ( //indent:6 exp:8 warn - test //indent:12 exp:12 - ) { //indent:6 exp:8 warn - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 -if (test //indent:0 exp:8 warn -|| test) { //indent:0 exp:12 warn -System.getProperty("blah"); //indent:0 exp:12 warn -} //indent:0 exp:8 warn -if (test) //indent:0 exp:8 warn -System.getProperty("blah"); //indent:0 exp:12 warn -else //indent:0 exp:8 warn -System.getProperty("blah"); //indent:0 exp:12 warn - - } //indent:4 exp:4 - } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent1.java new file mode 100644 index 00000000000..137ff4c2f88 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent1.java @@ -0,0 +1,103 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationInvalidIfIndent1 { //indent:0 exp:0 + + ///// same as above, with statements //indent:4 exp:4 + public void populatedIfTest() //indent:4 exp:4 + { //indent:4 exp:4 + boolean test = false; //indent:8 exp:8 + // no braces if //indent:8 exp:8 + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:14 exp:>=12 + + // no braces if/else //indent:8 exp:8 + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:>=12 + else //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:>=12 + + + // lcurly on same line, and stmt //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:14 exp:12 warn + } //indent:8 exp:8 + + // lcurly on next line and stmt //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:10 exp:8 warn + System.getProperty("blah"); //indent:10 exp:12 warn + } //indent:8 exp:8 + // lcurly for if and else on same line //indent:8 exp:8 + if (test) { //indent:8 exp:8 + + System. //indent:14 exp:12 warn + getProperty("blah"); //indent:10 exp:12 warn + } else { //indent:8 exp:8 + System. //indent:10 exp:12 warn + getProperty("blah"); //indent:8 exp:12 warn + } //indent:8 exp:8 + + // lcurly for if and else on same line //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + System.getProperty("blah"); //indent:16 exp:12 warn + } //indent:9 exp:8 warn + else //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:16 exp:12 warn + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 + if (test) { //indent:8 exp:8 +System.getProperty("blah"); //indent:0 exp:12 warn + } //indent:8 exp:8 + else //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:40 exp:12 warn + } //indent:8 exp:8 + + + // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:14 exp:12 warn + } else //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:14 exp:12 warn + } //indent:8 exp:8 + + // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:10 exp:12 warn + } else { //indent:8 exp:8 + System.getProperty("blah"); //indent:10 exp:12 warn + } //indent:8 exp:8 + + // lcurly for if and else on same line -- mixed braces, unnested //indent:8 exp:8 + if (test) { //indent:10 exp:8 warn + System.getProperty("blah"); //indent:14 exp:12 warn + } //indent:10 exp:8 warn + else { //indent:10 exp:8 warn + System.getProperty("blah"); //indent:14 exp:12 warn + } //indent:10 exp:8 warn + + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent2.java new file mode 100644 index 00000000000..0246c1e7ca5 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidIfIndent2.java @@ -0,0 +1,101 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationInvalidIfIndent2 { //indent:0 exp:0 + + ///// same as above, with statements //indent:4 exp:4 + public void populatedIfTest() //indent:4 exp:4 + { //indent:4 exp:4 + boolean test = false; //indent:8 exp:8 + + if (test //indent:8 exp:8 + && 7 < 8 && 8 < 9 //indent:9 exp:12 warn + && 10 < 11) { //indent:11 exp:12 warn + } //indent:8 exp:8 + + if (test) //indent:8 exp:8 + return; //indent:10 exp:12 warn + + if (test) { //indent:8 exp:8 + } else if (7 < 8) { //indent:7 exp:8 warn + } else if (8 < 9) { //indent:8 exp:8 + } //indent:8 exp:8 + + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:>=12 + } else if (7 < 8) { //indent:8 exp:8 + System.getProperty("blah"); //indent:10 exp:>=12 warn + } else if (8 < 9) { //indent:8 exp:8 + System.getProperty("blah"); //indent:10 exp:>=12 warn + } //indent:8 exp:8 + + + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + else if (7 < 8) //indent:8 exp:8 + System.getProperty("blah"); //indent:10 exp:12 warn + else if (8 < 9) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + + + // //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else //indent:8 exp:8 + if (7 < 8) { //indent:10 exp:12 warn + System.getProperty("blah"); //indent:16 exp:16 + } else //indent:12 exp:12 + if (8 < 9) { //indent:16 exp:16 + System.getProperty("blah"); //indent:18 exp:20 warn + } //indent:16 exp:16 + + if (test) { //indent:8 exp:8 + System.getProperty("blah"); } //indent:12 exp:12 + } //indent:4 exp:4 + + public void parenIfTest() { //indent:4 exp:4 + boolean test = true; //indent:8 exp:8 + + if (test //indent:8 exp:8 + ) { //indent:10 exp:8 warn + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + if (test //indent:8 exp:8 + ) //indent:6 exp:8 warn + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + if //indent:8 exp:8 + ( //indent:6 exp:8 warn + test //indent:12 exp:12 + ) { //indent:6 exp:8 warn + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 +if (test //indent:0 exp:8 warn +|| test) { //indent:0 exp:12 warn +System.getProperty("blah"); //indent:0 exp:12 warn +} //indent:0 exp:8 warn +if (test) //indent:0 exp:8 warn +System.getProperty("blah"); //indent:0 exp:12 warn +else //indent:0 exp:8 warn +System.getProperty("blah"); //indent:0 exp:12 warn + + } //indent:4 exp:4 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent1.java new file mode 100644 index 00000000000..fd25feacbba --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent1.java @@ -0,0 +1,103 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + + + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationInvalidMethodIndent1 { //indent:0 exp:0 + + /** Creates a new instance of InputInvalidMethodIndent */ //indent:4 exp:4 + public InputIndentationInvalidMethodIndent1() { //indent:4 exp:4 + } //indent:6 exp:4 warn + + // ctor with rcurly on next line //indent:4 exp:4 + public InputIndentationInvalidMethodIndent1(int dummy) //indent:6 exp:4 warn + { //indent:2 exp:4 warn + } //indent:6 exp:4 warn + + // method with rcurly on same line //indent:4 exp:4 + public void method() { //indent:2 exp:4 warn + } //indent:6 exp:4 warn + + // method with rcurly on next line //indent:4 exp:4 + public void method2() //indent:4 exp:4 + { //indent:4 exp:4 + } //indent:4 exp:4 + + // method with a bunch of params //indent:4 exp:4 + public int method2(int x, int y, int w, int h) { //indent:4 exp:4 + return 1; //indent:8 exp:8 + } //indent:4 exp:4 + + // params on multiple lines //indent:4 exp:4 + public void method2(int x, int y, int w, int h, //indent:4 exp:4 + int x1, int y1, int w1, int h1) //indent:8 exp:8 + { //indent:4 exp:4 + } //indent:4 exp:4 + + // params on multiple lines //indent:4 exp:4 + public void method3(int x, int y, int w, int h, //indent:4 exp:4 + int x1, int y1, int w1, int h1) //indent:8 exp:8 + { //indent:4 exp:4 + System.getProperty("foo"); //indent:8 exp:8 + } //indent:4 exp:4 + + + + // params on multiple lines //indent:4 exp:4 + public void method4(int x, int y, int w, int h, //indent:4 exp:4 + int x1, int y1, int w1, int h1) //indent:8 exp:8 + { //indent:4 exp:4 + boolean test = true; //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("foo"); //indent:12 exp:12 + } //indent:8 exp:8 + } //indent:4 exp:4 + + public //indent:5 exp:4 warn + final //indent:5 exp:9 warn + void //indent:5 exp:9 warn + method5() //indent:4 exp:9 warn + { //indent:4 exp:4 + boolean test = true; //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("foo"); //indent:12 exp:12 + } //indent:8 exp:8 + } //indent:4 exp:4 + + private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4 + } //indent:4 exp:4 + + private void myMethod() //indent:4 exp:4 + { //indent:4 exp:4 + myfunc2(3, 4, 5, //indent:8 exp:8 + 6, 7, 8, 9); //indent:10 exp:12 warn + + myfunc2(3, 4, method2(3, 4, 5, 6) + 5, //indent:8 exp:8 + 6, 7, 8, 9); //indent:10 exp:12 warn + + +// : this is not illegal, but probably should be //indent:0 exp:0 +// myfunc3(11, 11, Integer. //indent:0 exp:0 +// getInteger("mytest").intValue(), //indent:0 exp:0 +// 11); //indent:0 exp:0 + + + String.CASE_INSENSITIVE_ORDER.toString() //indent:8 exp:8 + .equals("blah"); //indent:6 exp:12 warn + + + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent2.java similarity index 60% rename from src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent.java rename to src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent2.java index 166e38fb097..6c7d92c3c52 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationInvalidMethodIndent2.java @@ -16,65 +16,11 @@ * //indent:1 exp:1 * @author jrichard //indent:1 exp:1 */ //indent:1 exp:1 -public class InputIndentationInvalidMethodIndent { //indent:0 exp:0 +public class InputIndentationInvalidMethodIndent2 { //indent:0 exp:0 - /** Creates a new instance of InputInvalidMethodIndent */ //indent:4 exp:4 - public InputIndentationInvalidMethodIndent() { //indent:4 exp:4 - } //indent:6 exp:4 warn - - // ctor with rcurly on next line //indent:4 exp:4 - public InputIndentationInvalidMethodIndent(int dummy) //indent:6 exp:4 warn - { //indent:2 exp:4 warn - } //indent:6 exp:4 warn - - // method with rcurly on same line //indent:4 exp:4 - public void method() { //indent:2 exp:4 warn - } //indent:6 exp:4 warn - - // method with rcurly on next line //indent:4 exp:4 - public void method2() //indent:4 exp:4 - { //indent:4 exp:4 - } //indent:4 exp:4 - - // method with a bunch of params //indent:4 exp:4 - public int method2(int x, int y, int w, int h) { //indent:4 exp:4 - return 1; //indent:8 exp:8 - } //indent:4 exp:4 - - // params on multiple lines //indent:4 exp:4 - public void method2(int x, int y, int w, int h, //indent:4 exp:4 - int x1, int y1, int w1, int h1) //indent:8 exp:8 - { //indent:4 exp:4 - } //indent:4 exp:4 - - // params on multiple lines //indent:4 exp:4 - public void method3(int x, int y, int w, int h, //indent:4 exp:4 - int x1, int y1, int w1, int h1) //indent:8 exp:8 - { //indent:4 exp:4 - System.getProperty("foo"); //indent:8 exp:8 - } //indent:4 exp:4 - - - - // params on multiple lines //indent:4 exp:4 - public void method4(int x, int y, int w, int h, //indent:4 exp:4 - int x1, int y1, int w1, int h1) //indent:8 exp:8 - { //indent:4 exp:4 - boolean test = true; //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("foo"); //indent:12 exp:12 - } //indent:8 exp:8 - } //indent:4 exp:4 - - public //indent:5 exp:4 warn - final //indent:5 exp:9 warn - void //indent:5 exp:9 warn - method5() //indent:4 exp:9 warn + public InputIndentationInvalidMethodIndent2(int dummy, int dummy2) //indent:4 exp:4 { //indent:4 exp:4 - boolean test = true; //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("foo"); //indent:12 exp:12 - } //indent:8 exp:8 + System.getProperty("foo"); //indent:4 exp:8 warn } //indent:4 exp:4 public //indent:3 exp:4 warn @@ -88,11 +34,6 @@ public void method4(int x, int y, int w, int h, //indent:4 exp:4 } //indent:8 exp:8 } //indent:4 exp:4 - public InputIndentationInvalidMethodIndent(int dummy, int dummy2) //indent:4 exp:4 - { //indent:4 exp:4 - System.getProperty("foo"); //indent:4 exp:8 warn - } //indent:4 exp:4 - void method6a() //indent:4 exp:4 { //indent:4 exp:4 boolean test = true; //indent:6 exp:8 warn @@ -131,35 +72,10 @@ void method6a() //indent:4 exp:4 ); //indent:6 exp:8 warn } //indent:4 exp:4 - - private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4 - } //indent:4 exp:4 - private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4 return 1; //indent:8 exp:8 } //indent:4 exp:4 - private void myMethod() //indent:4 exp:4 - { //indent:4 exp:4 - myfunc2(3, 4, 5, //indent:8 exp:8 - 6, 7, 8, 9); //indent:10 exp:12 warn - - myfunc2(3, 4, method2(3, 4, 5, 6) + 5, //indent:8 exp:8 - 6, 7, 8, 9); //indent:10 exp:12 warn - - -// : this is not illegal, but probably should be //indent:0 exp:0 -// myfunc3(11, 11, Integer. //indent:0 exp:0 -// getInteger("mytest").intValue(), //indent:0 exp:0 -// 11); //indent:0 exp:0 - - - String.CASE_INSENSITIVE_ORDER.toString() //indent:8 exp:8 - .equals("blah"); //indent:6 exp:12 warn - - - } //indent:4 exp:4 - private void myFunc() //indent:4 exp:4 throws Exception //indent:8 exp:8 { //indent:4 exp:4 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels.java index 8bc1b9341a6..aec731f8c83 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels.java @@ -112,54 +112,4 @@ void foooo4() { //indent:4 exp:4 do {} while (true); //indent:6 exp:6 } //indent:4 exp:4 } //indent:2 exp:2 - - InputIndentationLabels anon = new InputIndentationLabels() { //indent:2 exp:2 - void foo() { //indent:4 exp:4 - OUT: while (true) { //indent:6 exp:6 - } //indent:6 exp:6 - } //indent:4 exp:4 - - void foo2() { //indent:4 exp:4 - positions: //indent:6 exp:6 - while (true) { //indent:6 exp:6 - } //indent:6 exp:6 - } //indent:4 exp:4 - - void foo5() { //indent:4 exp:4 - OUT1: //indent:6 exp:6 - for (;;) { //indent:6 exp:6 - if (true){ //indent:8 exp:8 - break OUT1; //indent:10 exp:10 - } //indent:8 exp:8 - } //indent:6 exp:6 - } //indent:4 exp:4 - - void foo6() { //indent:4 exp:4 - OUT1: for (;;) { //indent:6 exp:6 - if (true){ //indent:8 exp:8 - break OUT1; //indent:10 exp:10 - } //indent:8 exp:8 - } //indent:6 exp:6 - } //indent:4 exp:4 - - void fooo11() { //indent:4 exp:4 - IN: if (true) { //indent:6 exp:6 - } //indent:6 exp:6 - } //indent:4 exp:4 - - void fooo12() { //indent:4 exp:4 - IN: //indent:6 exp:6 - if (true) { //indent:6 exp:6 - } //indent:6 exp:6 - } //indent:4 exp:4 - - void foooo3() { //indent:4 exp:4 - IN: do {} while (true); //indent:6 exp:6 - } //indent:4 exp:4 - - void foooo4() { //indent:4 exp:4 - IN: //indent:6 exp:6 - do {} while (true); //indent:6 exp:6 - } //indent:4 exp:4 - }; //indent:2 exp:2 } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels1.java new file mode 100644 index 00000000000..a6024f57203 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLabels1.java @@ -0,0 +1,68 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 2 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationLabels1 { //indent:0 exp:0 + + InputIndentationLabels anon = new InputIndentationLabels() { //indent:2 exp:2 + void foo() { //indent:4 exp:4 + OUT: while (true) { //indent:6 exp:6 + } //indent:6 exp:6 + } //indent:4 exp:4 + + void foo2() { //indent:4 exp:4 + positions: //indent:6 exp:6 + while (true) { //indent:6 exp:6 + } //indent:6 exp:6 + } //indent:4 exp:4 + + void foo5() { //indent:4 exp:4 + OUT1: //indent:6 exp:6 + for (;;) { //indent:6 exp:6 + if (true){ //indent:8 exp:8 + break OUT1; //indent:10 exp:10 + } //indent:8 exp:8 + } //indent:6 exp:6 + } //indent:4 exp:4 + + void foo6() { //indent:4 exp:4 + OUT1: for (;;) { //indent:6 exp:6 + if (true){ //indent:8 exp:8 + break OUT1; //indent:10 exp:10 + } //indent:8 exp:8 + } //indent:6 exp:6 + } //indent:4 exp:4 + + void fooo11() { //indent:4 exp:4 + IN: if (true) { //indent:6 exp:6 + } //indent:6 exp:6 + } //indent:4 exp:4 + + void fooo12() { //indent:4 exp:4 + IN: //indent:6 exp:6 + if (true) { //indent:6 exp:6 + } //indent:6 exp:6 + } //indent:4 exp:4 + + void foooo3() { //indent:4 exp:4 + IN: do {} while (true); //indent:6 exp:6 + } //indent:4 exp:4 + + void foooo4() { //indent:4 exp:4 + IN: //indent:6 exp:6 + do {} while (true); //indent:6 exp:6 + } //indent:4 exp:4 + }; //indent:2 exp:2 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda.java new file mode 100644 index 00000000000..7df73bb45c3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda.java @@ -0,0 +1,118 @@ +//a comment //indent:0 exp:0 +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLambda { //indent:0 exp:0 + java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(""); //indent:2 exp:2 + interface Printer //indent:2 exp:2 + { //indent:2 exp:2 + void print(String s); //indent:4 exp:4 + } //indent:2 exp:2 + + class LongTypeName { //indent:2 exp:2 + } //indent:2 exp:2 + + interface SomeInterface { //indent:2 exp:2 + void someFunction(InputIndentationLambda.LongTypeName arg); //indent:4 exp:4 + } //indent:2 exp:2 + + void function1(Runnable x) { //indent:2 exp:2 + Runnable r1 = () -> { //indent:4 exp:4 + x.run(); //indent:6 exp:6 + }; //indent:4 exp:4 + + Runnable r2 = () -> { x.run(); }; //indent:4 exp:4 + + Runnable r3 = () -> //indent:4 exp:4 + x.run(); //indent:8 exp:8 + + Runnable r4 = () -> x.run(); //indent:4 exp:4 + + InputIndentationLambda.Printer r5 = s -> LOG.info(s); //indent:4 exp:4 + + InputIndentationLambda.Printer r6 = s -> String.CASE_INSENSITIVE_ORDER //indent:4 exp:4 + .equals(s); //indent:8 exp:8 + + Runnable r7 = () //indent:4 exp:4 + -> //indent:8 exp:8 + { //indent:5 exp:4,8 warn + }; //indent:5 exp:4,8 warn + + Runnable r8 = //indent:4 exp:4 + () //indent:9 exp:9 + -> //indent:11 exp:12 warn + {}; //indent:9 exp:8 warn + + Runnable r9 = //indent:4 exp:4 + () //indent:8 exp:8 + -> //indent:12 exp:12 + {}; //indent:8 exp:8 + + Object o = new Thread(() -> { //indent:4 exp:4 + x.run(); //indent:6 exp:6 + }); //indent:4 exp:4 + + Runnable r01 = () -> { //indent:4 exp:4 + x.run(); //indent:7 exp:6 warn + }; //indent:5 exp:4 warn + + Runnable r11 = //indent:4 exp:4 + () -> { //indent:8 exp:8 + x.run(); //indent:10 exp:10 + }; //indent:8 exp:8 + + Runnable r21 = //indent:4 exp:4 + () -> { x.run(); }; //indent:8 exp:8 + + Runnable r31 = //indent:4 exp:4 + () -> x //indent:8 exp:8 + .run(); //indent:12 exp:12 + + Runnable r41 = //indent:4 exp:4 + () -> x.run(); //indent:8 exp:8 + + InputIndentationLambda.Printer r51 = //indent:4 exp:4 + s -> LOG.info(s); //indent:8 exp:8 + + InputIndentationLambda.Printer r61 = //indent:4 exp:4 + s -> String.CASE_INSENSITIVE_ORDER //indent:8 exp:8 + .equals(s); //indent:12 exp:12 + + Object o1 = new Thread( //indent:4 exp:4 + () -> { //indent:8 exp:8 + x.run(); //indent:10 exp:10 + }); //indent:8 exp:8 + + Object o2 = new Thread(() -> { //indent:4 exp:4 + x.run(); //indent:6 exp:6 + }).toString(); //indent:4 exp:4 + + InputIndentationLambda.SomeInterface i1 = (InputIndentationLambda.LongTypeName //indent:4 exp:4 + arg) -> { //indent:8 exp:8 + LOG.info(arg.toString()); //indent:6 exp:6 + }; //indent:4 exp:4 + + InputIndentationLambda.Printer[] mRun = new InputIndentationLambda.Printer[] { //indent:4 exp:4 + s -> LOG.info(s), //indent:8 exp:6,8 + s -> { LOG.info(s); }, //indent:8 exp:6,8 + s -> LOG //indent:8 exp:6,8 + .info(s), //indent:12 exp:12 + s -> { //indent:8 exp:6,8 + LOG.info(s); //indent:10 exp:10 + }, //indent:8 exp:8 + }; //indent:4 exp:4 + } //indent:2 exp:2 + + void function3(Runnable x) { //indent:2 exp:2 + function1(() -> { //indent:4 exp:4 + x.run(); //indent:6 exp:6 + }); //indent:4 exp:4 + } //indent:2 exp:2 + + class Person { //indent:2 exp:2 + String name; //indent:4 exp:4 + int age; //indent:4 exp:4 + Person(String name, int age) { //indent:4 exp:4 + } //indent:4 exp:4 + } //indent:2 exp:2 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda1.java index f6bddf6340d..33951c14409 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda1.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLambda1.java @@ -12,117 +12,6 @@ public class InputIndentationLambda1 { //indent:0 exp:0 java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(""); //indent:2 exp:2 - interface Printer //indent:2 exp:2 - { //indent:2 exp:2 - void print(String s); //indent:4 exp:4 - } //indent:2 exp:2 - - class LongTypeName { //indent:2 exp:2 - } //indent:2 exp:2 - - interface SomeInterface { //indent:2 exp:2 - void someFunction(LongTypeName arg); //indent:4 exp:4 - } //indent:2 exp:2 - - void function1(Runnable x) { //indent:2 exp:2 - Runnable r1 = () -> { //indent:4 exp:4 - x.run(); //indent:6 exp:6 - }; //indent:4 exp:4 - - Runnable r2 = () -> { x.run(); }; //indent:4 exp:4 - - Runnable r3 = () -> //indent:4 exp:4 - x.run(); //indent:8 exp:8 - - Runnable r4 = () -> x.run(); //indent:4 exp:4 - - Printer r5 = s -> LOG.info(s); //indent:4 exp:4 - - Printer r6 = s -> String.CASE_INSENSITIVE_ORDER //indent:4 exp:4 - .equals(s); //indent:8 exp:8 - - Runnable r7 = () //indent:4 exp:4 - -> //indent:8 exp:8 - { //indent:5 exp:4,8 warn - }; //indent:5 exp:4,8 warn - - Runnable r8 = //indent:4 exp:4 - () //indent:9 exp:9 - -> //indent:11 exp:12 warn - {}; //indent:9 exp:8 warn - - Runnable r9 = //indent:4 exp:4 - () //indent:8 exp:8 - -> //indent:12 exp:12 - {}; //indent:8 exp:8 - - Object o = new Thread(() -> { //indent:4 exp:4 - x.run(); //indent:6 exp:6 - }); //indent:4 exp:4 - - Runnable r01 = () -> { //indent:4 exp:4 - x.run(); //indent:7 exp:6 warn - }; //indent:5 exp:4 warn - - Runnable r11 = //indent:4 exp:4 - () -> { //indent:8 exp:8 - x.run(); //indent:10 exp:10 - }; //indent:8 exp:8 - - Runnable r21 = //indent:4 exp:4 - () -> { x.run(); }; //indent:8 exp:8 - - Runnable r31 = //indent:4 exp:4 - () -> x //indent:8 exp:8 - .run(); //indent:12 exp:12 - - Runnable r41 = //indent:4 exp:4 - () -> x.run(); //indent:8 exp:8 - - Printer r51 = //indent:4 exp:4 - s -> LOG.info(s); //indent:8 exp:8 - - Printer r61 = //indent:4 exp:4 - s -> String.CASE_INSENSITIVE_ORDER //indent:8 exp:8 - .equals(s); //indent:12 exp:12 - - Object o1 = new Thread( //indent:4 exp:4 - () -> { //indent:8 exp:8 - x.run(); //indent:10 exp:10 - }); //indent:8 exp:8 - - Object o2 = new Thread(() -> { //indent:4 exp:4 - x.run(); //indent:6 exp:6 - }).toString(); //indent:4 exp:4 - - SomeInterface i1 = (LongTypeName //indent:4 exp:4 - arg) -> { //indent:8 exp:8 - LOG.info(arg.toString()); //indent:6 exp:6 - }; //indent:4 exp:4 - - Printer[] manyRunnable = new Printer[]{ //indent:4 exp:4 - s -> LOG.info(s), //indent:8 exp:6,8 - s -> { LOG.info(s); }, //indent:8 exp:6,8 - s -> LOG //indent:8 exp:6,8 - .info(s), //indent:12 exp:12 - s -> { //indent:8 exp:6,8 - LOG.info(s); //indent:10 exp:10 - }, //indent:8 exp:8 - }; //indent:4 exp:4 - } //indent:2 exp:2 - - void function3(Runnable x) { //indent:2 exp:2 - function1(() -> { //indent:4 exp:4 - x.run(); //indent:6 exp:6 - }); //indent:4 exp:4 - } //indent:2 exp:2 - - class Person { //indent:2 exp:2 - String name; //indent:4 exp:4 - int age; //indent:4 exp:4 - Person(String name, int age) { //indent:4 exp:4 - } //indent:4 exp:4 - } //indent:2 exp:2 class Foo { //indent:2 exp:2 String name; //indent:4 exp:4 @@ -151,17 +40,17 @@ public void f() { //indent:2 exp:2 return s.startsWith("A"); //indent:10 exp:10 }); //indent:8 exp:8 - List persons = null; //indent:4 exp:4 + List persons = null; //indent:4 exp:4 - Map> personsByAge = persons //indent:4 exp:4 + Map> personsByAge = persons //indent:4 exp:4 .stream() //indent:8 exp:8 .collect(Collectors.groupingBy(p -> p.age)); //indent:8 exp:8 personsByAge //indent:4 exp:4 .forEach((age, p) -> LOG.info("age %s: %s\n")); //indent:8 exp:8 - Collector personNameCollector = //indent:4 exp:4 - Collector.of( //indent:8 exp:8 + Collector //indent:4 exp:4 + personNameCollector = Collector.of( //indent:8 exp:8 () -> new StringJoiner(" | "), //indent:12 exp:12 (j, p) -> j.add(p.name.toUpperCase(java.util.Locale.getDefault())), //indent:12 exp:12 (j1, j2) -> j1.merge(j2), //indent:12 exp:12 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString.java index e438f5c98ed..33363fa7bb3 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString.java @@ -111,1129 +111,6 @@ public void test() { //indent:4 exp:4 " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 } //indent:4 exp:4 } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString1.java new file mode 100644 index 00000000000..56efea9f0ff --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString1.java @@ -0,0 +1,115 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString1 { //indent:0 exp:0 + + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString10.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString10.java new file mode 100644 index 00000000000..37e0cce93cd --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString10.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString10 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString11.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString11.java new file mode 100644 index 00000000000..46dd74e32a0 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString11.java @@ -0,0 +1,115 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString11 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString2.java new file mode 100644 index 00000000000..4469a422495 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString2.java @@ -0,0 +1,115 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString2 { //indent:0 exp:0 + + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString3.java new file mode 100644 index 00000000000..960fcb6649e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString3.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString3 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString4.java new file mode 100644 index 00000000000..f5c40f18962 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString4.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString4 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString5.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString5.java new file mode 100644 index 00000000000..1cb612d424a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString5.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString5 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString6.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString6.java new file mode 100644 index 00000000000..26d97e57d65 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString6.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString6 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString7.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString7.java new file mode 100644 index 00000000000..ef600078b66 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString7.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString7 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString8.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString8.java new file mode 100644 index 00000000000..c350f9323c4 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString8.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString8 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString9.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString9.java new file mode 100644 index 00000000000..0ba80104bc0 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationLongConcatenatedString9.java @@ -0,0 +1,114 @@ +/* Config: //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + */ //indent:1 exp:1 + +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +public class InputIndentationLongConcatenatedString9 { //indent:0 exp:0 + public void test() { //indent:4 exp:4 + String s = " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:8 exp:8 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + //indent:16 exp:16 + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; //indent:16 exp:16 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java index 0356f3eaac3..dc1f1e6a25f 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict.java @@ -5,7 +5,6 @@ import java.nio.charset.Charset; //indent:0 exp:0 import java.nio.charset.MalformedInputException; //indent:0 exp:0 import java.nio.charset.StandardCharsets; //indent:0 exp:0 -import java.nio.file.DirectoryStream; //indent:0 exp:0 import java.nio.file.Files; //indent:0 exp:0 import java.nio.file.Path; //indent:0 exp:0 import java.nio.file.Paths; //indent:0 exp:0 @@ -100,84 +99,6 @@ static void fooMethod(String zipFileName) throws IOException { //indent:4 exp:4 } catch (IOException e) { //indent:8 exp:8 throw e; //indent:12 exp:12 } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 - ZipFile zf = new ZipFile( //indent:12 exp:12 - zipFileName) //indent:16 exp:16 - ) { //indent:12 exp:>=8 - zf.getName(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 - ZipFile zf = new ZipFile( //indent:12 exp:12 - zipFileName) //indent:17 exp:>=16 - ) { //indent:12 exp:>=8 - zf.getName(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 - ZipFile zf = new ZipFile( //indent:12 exp:12 - zipFileName) //indent:15 exp:>=16 warn - ) { //indent:12 exp:>=8 - zf.getName(); //indent:12 exp:12 - } //indent:8 exp:8 - try (BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 - writer.close(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 - writer.close(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:7 exp:8 warn - - - BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:12 exp:12 - writer.close(); //indent:15 exp:12 warn - } //indent:8 exp:8 - try ( //indent:8 exp:8 - - - - BufferedWriter writer = Files.newBufferedWriter(null, charset)) { //indent:11 exp:12 warn - writer.close(); //indent:9 exp:12 warn - } //indent:8 exp:8 - try ( //indent:8 exp:8 - - BufferedWriter writer = Files. //indent:11 exp:12 warn - newBufferedWriter(filePath, charset)) { //indent:11 exp:16 warn - writer.close(); //indent:13 exp:12 warn - } //indent:8 exp:8 - try (BufferedWriter writer = writ //indent:7 exp:8 warn - ) { //indent:7 exp:>=8,12 warn - } catch (MalformedInputException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 - try (BufferedWriter writer1 = writ; //indent:8 exp:8 - BufferedWriter writer2 = writ; //indent:12 exp:>=12 - BufferedWriter writer3 = writ; //indent:13 exp:>=12 - BufferedWriter writer4 = writ; //indent:14 exp:>=12 - BufferedWriter writer5 = writ) { //indent:15 exp:>=12 - } catch (MalformedInputException e) { //indent:8 exp:8 - ; //indent:12 exp:12 - } //indent:8 exp:8 - try (BufferedWriter writer = Files //indent:8 exp:8 - .newBufferedWriter(filePath, charset)) { //indent:8 exp:>=12 warn - ; //indent:12 exp:12 - } //indent:8 exp:8 - try (BufferedWriter writer = Files //indent:8 exp:8 - .newBufferedWriter(filePath, charset)) { //indent:13 exp:>=12 - ; //indent:12 exp:12 - } //indent:8 exp:8 - try (DirectoryStream ds = Files.newDirectoryStream(filePath, //indent:8 exp:8 - new DirectoryStream.Filter() { //indent:11 exp:>=12 warn - @Override //indent:16 exp:16 - public boolean accept(Path path) { //indent:16 exp:16 - return path.toString().contains(""); //indent:20 exp:20 - } //indent:16 exp:16 - })) //indent:12 exp:12 - { //indent:8 exp:8 - for (Path p : ds) //indent:12 exp:12 - ; //indent:16 exp:16 - } //indent:8 exp:8 } //indent:4 exp:4 } //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict1.java new file mode 100644 index 00000000000..3628d1f69e0 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryResourcesNotStrict1.java @@ -0,0 +1,109 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.io.BufferedWriter; //indent:0 exp:0 +import java.io.IOException; //indent:0 exp:0 +import java.nio.charset.Charset; //indent:0 exp:0 +import java.nio.charset.MalformedInputException; //indent:0 exp:0 +import java.nio.charset.StandardCharsets; //indent:0 exp:0 +import java.nio.file.DirectoryStream; //indent:0 exp:0 +import java.nio.file.Files; //indent:0 exp:0 +import java.nio.file.Path; //indent:0 exp:0 +import java.nio.file.Paths; //indent:0 exp:0 +import java.util.zip.ZipFile; //indent:0 exp:0 + +public class InputIndentationTryResourcesNotStrict1 { //indent:0 exp:0 + + private InputIndentationTryResourcesNotStrict1() { //indent:4 exp:4 + + } //indent:4 exp:4 + + static void fooMethod(String zipFileName) throws IOException { //indent:4 exp:4 + + Charset charset = StandardCharsets.US_ASCII; //indent:8 exp:8 + Path filePath = Paths.get(zipFileName); //indent:8 exp:8 + + BufferedWriter writ = Files.newBufferedWriter(filePath, charset); //indent:8 exp:8 + + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:16 exp:16 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:17 exp:>=16 + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:15 exp:>=16 warn + ) { //indent:12 exp:>=8 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:7 exp:8 warn + + + + BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:12 exp:12 + writer.close(); //indent:15 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + + + BufferedWriter writer = Files.newBufferedWriter(null, charset)) { //indent:11 exp:12 warn + writer.close(); //indent:9 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + BufferedWriter writer = Files. //indent:11 exp:12 warn + newBufferedWriter(filePath, charset)) { //indent:11 exp:16 warn + writer.close(); //indent:13 exp:12 warn + } //indent:8 exp:8 + try (BufferedWriter writer = writ //indent:7 exp:8 warn + ) { //indent:7 exp:>=8,12 warn + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer1 = writ; //indent:8 exp:8 + BufferedWriter writer2 = writ; //indent:12 exp:>=12 + BufferedWriter writer3 = writ; //indent:13 exp:>=12 + BufferedWriter writer4 = writ; //indent:14 exp:>=12 + BufferedWriter writer5 = writ) { //indent:15 exp:>=12 + } catch (MalformedInputException e) { //indent:8 exp:8 + ; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files //indent:8 exp:8 + .newBufferedWriter(filePath, charset)) { //indent:8 exp:>=12 warn + ; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files //indent:8 exp:8 + .newBufferedWriter(filePath, charset)) { //indent:13 exp:>=12 + ; //indent:12 exp:12 + } //indent:8 exp:8 + try (DirectoryStream ds = Files.newDirectoryStream(filePath, //indent:8 exp:8 + new DirectoryStream.Filter() { //indent:11 exp:>=12 warn + @Override //indent:16 exp:16 + public boolean accept(Path path) { //indent:16 exp:16 + return path.toString().contains(""); //indent:20 exp:20 + } //indent:16 exp:16 + })) //indent:12 exp:12 + { //indent:8 exp:8 + for (Path p : ds) //indent:12 exp:12 + ; //indent:16 exp:16 + } //indent:8 exp:8 + + } //indent:4 exp:4 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java index 6d14e5c5436..153ecc956ea 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict.java @@ -74,89 +74,7 @@ static void fooMethod(String zipFileName) throws IOException { //indent:4 exp:4 } catch (Exception e) { //indent:8 exp:8 } //indent:8 exp:8 - BufferedWriter writ = Files.newBufferedWriter(filePath, charset); //indent:8 exp:8 - try (BufferedWriter writer = writ) { //indent:8 exp:8 - Integer.parseInt("2"); //indent:12 exp:12 - } catch (IOException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 - try ( BufferedWriter writer = //indent:8 exp:8 - writ) { //indent:19 exp:12 warn - Integer.parseInt("2"); //indent:12 exp:12 - } catch (IOException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = //indent:12 exp:12 - writ) { //indent:19 exp:16 warn - Integer.parseInt("2"); //indent:12 exp:12 - } catch (IOException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = //indent:12 exp:12 - writ) { //indent:21 exp:16 warn - Integer.parseInt("2"); //indent:12 exp:12 - } catch (IOException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 - ZipFile zf = new ZipFile( //indent:12 exp:12 - zipFileName) //indent:16 exp:16 - ) { //indent:12 exp:8,12 - zf.getName(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 - ZipFile zf = new ZipFile( //indent:12 exp:12 - zipFileName) //indent:17 exp:16 warn - ) { //indent:12 exp:8,12 - zf.getName(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:8 exp:8 - BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 - ZipFile zf = new ZipFile( //indent:12 exp:12 - zipFileName) //indent:15 exp:16 warn - ) { //indent:12 exp:8,12 - zf.getName(); //indent:12 exp:12 - } //indent:8 exp:8 - try (BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 - writer.close(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 - writer.close(); //indent:12 exp:12 - } //indent:8 exp:8 - try ( //indent:7 exp:8 warn - - - - BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:12 exp:12 - writer.close(); //indent:15 exp:12 warn - } //indent:8 exp:8 - try ( //indent:8 exp:8 - - - BufferedWriter writer = Files.newBufferedWriter(null, charset)) { //indent:11 exp:12 warn - writer.close(); //indent:9 exp:12 warn - } //indent:8 exp:8 - try ( //indent:8 exp:8 - - BufferedWriter writer = Files. //indent:11 exp:12 warn - newBufferedWriter(filePath, charset)) { //indent:11 exp:16 warn - writer.close(); //indent:13 exp:12 warn - } //indent:8 exp:8 - try (BufferedWriter writer = writ //indent:7 exp:8 warn - ) { //indent:7 exp:8,12 warn - } catch (MalformedInputException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 - try (BufferedWriter writer = writ //indent:9 exp:8 warn - ) { //indent:12 exp:8,12 - } catch (MalformedInputException e) { //indent:8 exp:8 - throw e; //indent:12 exp:12 - } //indent:8 exp:8 try (BufferedWriter writer = Files //indent:8 exp:8 .newBufferedWriter(filePath, charset)//indent:13 exp:12 warn ) { //indent:12 exp:8,12 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict1.java new file mode 100644 index 00000000000..214d1fdba36 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationTryWithResourcesStrict1.java @@ -0,0 +1,110 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.io.BufferedWriter; //indent:0 exp:0 +import java.io.IOException; //indent:0 exp:0 +import java.nio.charset.Charset; //indent:0 exp:0 +import java.nio.charset.MalformedInputException; //indent:0 exp:0 +import java.nio.charset.StandardCharsets; //indent:0 exp:0 +import java.nio.file.Files; //indent:0 exp:0 +import java.nio.file.Path; //indent:0 exp:0 +import java.nio.file.Paths; //indent:0 exp:0 +import java.util.zip.ZipFile; //indent:0 exp:0 + +public class InputIndentationTryWithResourcesStrict1 { //indent:0 exp:0 + + private InputIndentationTryWithResourcesStrict1() { //indent:4 exp:4 + + } //indent:4 exp:4 + + static void fooMethod(String zipFileName) throws IOException { //indent:4 exp:4 + + Charset charset = StandardCharsets.US_ASCII; //indent:8 exp:8 + Path filePath = Paths.get(zipFileName); //indent:8 exp:8 + + BufferedWriter writ = Files.newBufferedWriter(filePath, charset); //indent:8 exp:8 + try (BufferedWriter writer = writ) { //indent:8 exp:8 + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = //indent:8 exp:8 + writ) { //indent:19 exp:12 warn + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = //indent:12 exp:12 + writ) { //indent:19 exp:16 warn + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = //indent:12 exp:12 + writ) { //indent:21 exp:16 warn + Integer.parseInt("2"); //indent:12 exp:12 + } catch (IOException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:16 exp:16 + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:17 exp:16 warn + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:8 exp:8 + BufferedWriter writer = Files.newBufferedWriter(filePath, charset); //indent:12 exp:12 + ZipFile zf = new ZipFile( //indent:12 exp:12 + zipFileName) //indent:15 exp:16 warn + ) { //indent:12 exp:8,12 + zf.getName(); //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:8 exp:8 + writer.close(); //indent:12 exp:12 + } //indent:8 exp:8 + try ( //indent:7 exp:8 warn + + + + BufferedWriter writer = Files.newBufferedWriter(filePath, charset)) { //indent:12 exp:12 + writer.close(); //indent:15 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + + + BufferedWriter writer = Files.newBufferedWriter(null, charset)) { //indent:11 exp:12 warn + writer.close(); //indent:9 exp:12 warn + } //indent:8 exp:8 + try ( //indent:8 exp:8 + + BufferedWriter writer = Files. //indent:11 exp:12 warn + newBufferedWriter(filePath, charset)) { //indent:11 exp:16 warn + writer.close(); //indent:13 exp:12 warn + } //indent:8 exp:8 + try (BufferedWriter writer = writ //indent:7 exp:8 warn + ) { //indent:7 exp:8,12 warn + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + try (BufferedWriter writer = writ //indent:9 exp:8 warn + ) { //indent:12 exp:8,12 + } catch (MalformedInputException e) { //indent:8 exp:8 + throw e; //indent:12 exp:12 + } //indent:8 exp:8 + + } //indent:4 exp:4 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidArrayInitIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidArrayInitIndent.java index 16dfa4d32c1..284f4824c3b 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidArrayInitIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidArrayInitIndent.java @@ -32,7 +32,6 @@ public class InputIndentationValidArrayInitIndent { //indent:0 exp:0 3 //indent:12 exp:12 }; //indent:4 exp:4 - int[] array4 = new int[] //indent:4 exp:4 { //indent:4 exp:4 1, //indent:12 exp:12 @@ -43,7 +42,6 @@ public class InputIndentationValidArrayInitIndent { //indent:0 exp:0 int[] array5 = new int[] //indent:4 exp:4 {1, 2, 3}; //indent:4 exp:4 - // check nesting on first line //indent:4 exp:4 int[] array6 = new int[] { 1, 2, //indent:4 exp:4 3 //indent:12 exp:12 @@ -77,7 +75,6 @@ public class InputIndentationValidArrayInitIndent { //indent:0 exp:0 new int[] { 1, 2, 3}, //indent:12 exp:12 }; //indent:4 exp:4 - int[][] array10b //indent:4 exp:4 = new int[][] { //indent:8 exp:8 new int[] { 1, 2, 3}, //indent:16 exp:16 @@ -103,7 +100,6 @@ private void func1(int[] arg) { //indent:4 exp:4 } //indent:4 exp:4 - /** Creates a new instance of InputIndentationValidArrayInitIndent */ //indent:4 exp:4 public InputIndentationValidArrayInitIndent() { //indent:4 exp:4 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent.java index 7cb239dc26c..0961ae816ac 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent.java @@ -77,64 +77,6 @@ public void method1() { //indent:4 exp:4 } //indent:0 exp:0 -enum EquivalenceTester { //indent:0 exp:0 - /** //indent:4 exp:4 - * An equivalenster that decides based on {@link Object#equals(Object) equals}. //indent:5 exp:5 - */ //indent:5 exp:5 - OBJECT_ATTRIBUTES { //indent:4 exp:4 - /** //indent:8 exp:8 - * {@inheritDoc} //indent:9 exp:9 - */ //indent:9 exp:9 - public boolean areEqual( final Object first, final Object second ) { //indent:8 exp:8 - return true; //indent:12 exp:12 - } //indent:8 exp:8 - - /** //indent:8 exp:8 - * {@inheritDoc} //indent:9 exp:9 - */ //indent:9 exp:9 - public int hashCode( final Object target ) { //indent:8 exp:8 - return 1; //indent:12 exp:12 - } //indent:8 exp:8 - }, //indent:4 exp:4 - - /** //indent:4 exp:4 - * An equivalence tester that decides based on {@code ==}. //indent:5 exp:5 - */ //indent:5 exp:5 - OBJECT_IDENTITIES //indent:4 exp:4 - { //indent:4 exp:4 - /** //indent:8 exp:8 - * {@inheritDoc} //indent:9 exp:9 - */ //indent:9 exp:9 - public boolean areEqual( final Object first, final Object second ) { //indent:8 exp:8 - return first == second; //indent:12 exp:12 - } //indent:8 exp:8 - - /** //indent:8 exp:8 - * {@inheritDoc} //indent:9 exp:9 - */ //indent:9 exp:9 - public int hashCode( final Object target ) { //indent:8 exp:8 - return System.identityHashCode( target ); //indent:12 exp:12 - } //indent:8 exp:8 - }; //indent:4 exp:4 - - /** //indent:4 exp:4 - * Tells whether the two given objects are considered equivalent. //indent:5 exp:5 - * //indent:5 exp:5 - * @param first first comparand //indent:5 exp:5 - * @param second second comparand //indent:5 exp:5 - * @return whether {@code first} and {@code second} are considered equivalent //indent:5 exp:5 - */ //indent:5 exp:5 - public abstract boolean areEqual( Object first, Object second ); //indent:4 exp:4 - - /** //indent:4 exp:4 - * Computes a hash code for the given object. //indent:5 exp:5 - * //indent:5 exp:5 - * @param target object to compute a hash for //indent:5 exp:5 - * @return the computed hash //indent:5 exp:5 - */ //indent:5 exp:5 - public abstract int hashCode( Object target ); //indent:4 exp:4 -} //indent:0 exp:0 - class bug1251988 //indent:0 exp:0 { //indent:0 exp:0 private int a; //indent:4 exp:4 @@ -170,26 +112,3 @@ private static enum Command { //indent:4 exp:4 public String toString() { return c; } //indent:8 exp:8 } //indent:4 exp:4 } //indent:0 exp:0 - -class AnonymousClassWithInitializer { //indent:0 exp:0 - void create() { //indent:4 exp:4 - new Object() { //indent:8 exp:8 - { //indent:12 exp:12 - new Object(); //indent:16 exp:16 - } //indent:12 exp:12 - }; //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 - -class OneLineCode { //indent:0 exp:0 - void block() { //indent:4 exp:4 - { if (true) return; } //indent:8 exp:8 - } //indent:4 exp:4 - void lambda() { //indent:4 exp:4 - Stream.of(false).map(x -> { if (x) return 0; else return 1; }); //indent:8 exp:8 - } //indent:4 exp:4 - void tryCatchDoWhile(Closeable is) throws Exception { //indent:4 exp:4 - if (is != null) { try { is.close(); } catch (Exception e) {} } //indent:8 exp:8 - if (is != null) { do { is.close(); } while (is != null); } //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent1.java new file mode 100644 index 00000000000..d22e382ece9 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidBlockIndent1.java @@ -0,0 +1,108 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.io.Closeable; //indent:0 exp:0 +import java.util.stream.Stream; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationValidBlockIndent1 { //indent:0 exp:0 + + /** Creates a new instance of InputValidBlockIndent */ //indent:4 exp:4 + public InputIndentationValidBlockIndent1() { //indent:4 exp:4 + } //indent:4 exp:4 + +} //indent:0 exp:0 + +enum EquivalenceTester { //indent:0 exp:0 + /** //indent:4 exp:4 + * An equivalenster that decides based on {@link Object#equals(Object) equals}. //indent:5 exp:5 + */ //indent:5 exp:5 + OBJECT_ATTRIBUTES { //indent:4 exp:4 + /** //indent:8 exp:8 + * {@inheritDoc} //indent:9 exp:9 + */ //indent:9 exp:9 + public boolean areEqual( final Object first, final Object second ) { //indent:8 exp:8 + return true; //indent:12 exp:12 + } //indent:8 exp:8 + + /** //indent:8 exp:8 + * {@inheritDoc} //indent:9 exp:9 + */ //indent:9 exp:9 + public int hashCode( final Object target ) { //indent:8 exp:8 + return 1; //indent:12 exp:12 + } //indent:8 exp:8 + }, //indent:4 exp:4 + + /** //indent:4 exp:4 + * An equivalence tester that decides based on {@code ==}. //indent:5 exp:5 + */ //indent:5 exp:5 + OBJECT_IDENTITIES //indent:4 exp:4 + { //indent:4 exp:4 + /** //indent:8 exp:8 + * {@inheritDoc} //indent:9 exp:9 + */ //indent:9 exp:9 + public boolean areEqual( final Object first, final Object second ) { //indent:8 exp:8 + return first == second; //indent:12 exp:12 + } //indent:8 exp:8 + + /** //indent:8 exp:8 + * {@inheritDoc} //indent:9 exp:9 + */ //indent:9 exp:9 + public int hashCode( final Object target ) { //indent:8 exp:8 + return System.identityHashCode( target ); //indent:12 exp:12 + } //indent:8 exp:8 + }; //indent:4 exp:4 + + /** //indent:4 exp:4 + * Tells whether the two given objects are considered equivalent. //indent:5 exp:5 + * //indent:5 exp:5 + * @param first first comparand //indent:5 exp:5 + * @param second second comparand //indent:5 exp:5 + * @return whether {@code first} and {@code second} are considered equivalent //indent:5 exp:5 + */ //indent:5 exp:5 + public abstract boolean areEqual( Object first, Object second ); //indent:4 exp:4 + + /** //indent:4 exp:4 + * Computes a hash code for the given object. //indent:5 exp:5 + * //indent:5 exp:5 + * @param target object to compute a hash for //indent:5 exp:5 + * @return the computed hash //indent:5 exp:5 + */ //indent:5 exp:5 + public abstract int hashCode( Object target ); //indent:4 exp:4 +} //indent:0 exp:0 + +class AnonymousClassWithInitializer { //indent:0 exp:0 + void create() { //indent:4 exp:4 + new Object() { //indent:8 exp:8 + { //indent:12 exp:12 + new Object(); //indent:16 exp:16 + } //indent:12 exp:12 + }; //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 + +class OneLineCode { //indent:0 exp:0 + void block() { //indent:4 exp:4 + { if (true) return; } //indent:8 exp:8 + } //indent:4 exp:4 + void lambda() { //indent:4 exp:4 + Stream.of(false).map(x -> { if (x) return 0; else return 1; }); //indent:8 exp:8 + } //indent:4 exp:4 + void tryCatchDoWhile(Closeable is) throws Exception { //indent:4 exp:4 + if (is != null) { try { is.close(); } catch (Exception e) {} } //indent:8 exp:8 + if (is != null) { do { is.close(); } while (is != null); } //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 + diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent.java index 891e16702e1..5d585ab4fd4 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent.java @@ -23,39 +23,6 @@ public class InputIndentationValidClassDefIndent //indent:0 exp:0 extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:4 exp:>=4 -} //indent:0 exp:0 - -class InputIndentationValidClassDefIndent2 //indent:0 exp:0 - extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener //indent:4 exp:>=4 -{ //indent:0 exp:0 - -} //indent:0 exp:0 - -class InputIndentationValidClassDefIndent3 //indent:0 exp:0 - extends java.awt.event.MouseAdapter //indent:4 exp:>=4 - implements java.awt.event.MouseListener //indent:4 exp:>=4 -{ //indent:0 exp:0 - -} //indent:0 exp:0 - -final class InputIndentationValidClassDefIndent4 //indent:0 exp:0 - extends java.awt.event.MouseAdapter //indent:4 exp:>=4 - implements java.awt.event.MouseListener //indent:4 exp:>=4 -{ //indent:0 exp:0 - -} //indent:0 exp:0 - -final //indent:0 exp:0 -class InputIndentationValidClassDefIndent4a //indent:0 exp:>=4 warn - extends java.awt.event.MouseAdapter //indent:4 exp:>=4 - implements java.awt.event.MouseListener //indent:4 exp:>=4 -{ //indent:0 exp:0 - -} //indent:0 exp:0 - -final class InputIndentationValidClassDefIndent5 extends Object //indent:0 exp:0 -{ //indent:0 exp:0 - } //indent:0 exp:0 final class InputIndentationValidClassDefIndent6 extends Object { //indent:0 exp:0 @@ -145,21 +112,3 @@ public boolean co(Comparable ob1, Comparable ob2) //indent:16 ex } //indent:16 exp:16 }); //indent:12 exp:12 } //indent:0 exp:0 - -class HashingContainer { //indent:0 exp:0 - @Deprecated //indent:4 exp:4 - public Object[] table; //indent:4 exp:4 - - @Override //indent:4 exp:4 - public String toString() { //indent:4 exp:4 - return ""; //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 - -class Operator { //indent:0 exp:0 - public Operator(String str, OperatorHelper handler) { //indent:4 exp:4 - } //indent:4 exp:4 -} //indent:0 exp:0 - -class OperatorHelper { //indent:0 exp:0 -} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent1.java new file mode 100644 index 00000000000..64a46346cba --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidClassDefIndent1.java @@ -0,0 +1,71 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationValidClassDefIndent1 //indent:0 exp:0 + extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:4 exp:>=4 + +} //indent:0 exp:0 + +class InputIndentationValidClassDefIndent2 //indent:0 exp:0 + extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener //indent:4 exp:>=4 +{ //indent:0 exp:0 + +} //indent:0 exp:0 + +class InputIndentationValidClassDefIndent3 //indent:0 exp:0 + extends java.awt.event.MouseAdapter //indent:4 exp:>=4 + implements java.awt.event.MouseListener //indent:4 exp:>=4 +{ //indent:0 exp:0 + +} //indent:0 exp:0 + +final class InputIndentationValidClassDefIndent4 //indent:0 exp:0 + extends java.awt.event.MouseAdapter //indent:4 exp:>=4 + implements java.awt.event.MouseListener //indent:4 exp:>=4 +{ //indent:0 exp:0 + +} //indent:0 exp:0 + +final //indent:0 exp:0 +class InputIndentationValidClassDefIndent4a //indent:0 exp:>=4 warn + extends java.awt.event.MouseAdapter //indent:4 exp:>=4 + implements java.awt.event.MouseListener //indent:4 exp:>=4 +{ //indent:0 exp:0 + +} //indent:0 exp:0 + +final class InputIndentationValidClassDefIndent5 extends Object //indent:0 exp:0 +{ //indent:0 exp:0 + +} //indent:0 exp:0 + +class HashingContainer { //indent:0 exp:0 + @Deprecated //indent:4 exp:4 + public Object[] table; //indent:4 exp:4 + + @Override //indent:4 exp:4 + public String toString() { //indent:4 exp:4 + return ""; //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 + +class Operator { //indent:0 exp:0 + public Operator(String str, OperatorHelper handler) { //indent:4 exp:4 + } //indent:4 exp:4 +} //indent:0 exp:0 + +class OperatorHelper { //indent:0 exp:0 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent.java index 48aee4ae4e7..2e1e6486f37 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent.java @@ -77,142 +77,6 @@ public void emptyIfTest() //indent:4 exp:4 } //indent:4 exp:4 - ///// same as above, with statements //indent:4 exp:4 - public void populatedIfTest() //indent:4 exp:4 - { //indent:4 exp:4 - boolean test = false; //indent:8 exp:8 - // no braces if //indent:8 exp:8 - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - - // no braces if/else //indent:8 exp:8 - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - else //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - - - // lcurly on same line, and stmt //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - // lcurly on next line and stmt //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - // lcurly for if and else on same line //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else { //indent:8 exp:8 - System. //indent:12 exp:12 - getProperty("blah"); //indent:16 exp:>=16 - } //indent:8 exp:8 - - // lcurly for if and else on same line //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - else //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - else //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - - // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - // lcurly for if and else on same line -- mixed braces, unnested //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - else { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - if (test) System.getProperty("blah"); //indent:8 exp:8 - - if (test) System.getProperty("blah"); //indent:8 exp:8 - else System.getProperty("foo"); //indent:8 exp:8 - - if (test) System.getProperty("blah"); //indent:8 exp:8 - else //indent:8 exp:8 - System.getProperty("foo"); //indent:12 exp:12 - - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - else System.getProperty("foo"); //indent:8 exp:8 - - if (test //indent:8 exp:8 - && 7 < 8 && 8 < 9 //indent:12 exp:12 - && 10 < 11) { //indent:12 exp:12 - } //indent:8 exp:8 - - if (test) //indent:8 exp:8 - return; //indent:12 exp:12 - - - if (test) { //indent:8 exp:8 - } else if (7 < 8) { //indent:8 exp:8 - } else if (8 < 9) { //indent:8 exp:8 - } //indent:8 exp:8 - - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else if (7 < 8) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else if (8 < 9) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - - - if (test) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - else if (7 < 8) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - else if (8 < 9) //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - - - // : bother to support this style? //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else //indent:8 exp:8 - if (7 < 8) { //indent:12 exp:12 - System.getProperty("blah"); //indent:16 exp:16 - } else //indent:12 exp:12 - if (8 < 9) { //indent:16 exp:16 - System.getProperty("blah"); //indent:20 exp:20 - } //indent:16 exp:16 - - } //indent:4 exp:4 - public void parenIfTest() { //indent:4 exp:4 boolean test = true; //indent:8 exp:8 @@ -244,17 +108,3 @@ boolean foo() { //indent:4 exp:4 return true; //indent:8 exp:8 } //indent:4 exp:4 } //indent:0 exp:0 - -class FooFoo { //indent:0 exp:0 - void foo42() { //indent:4 exp:4 - boolean test = false; //indent:8 exp:8 - if (test) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } else if (7 < 8 //indent:8 exp:8 - && 8 < 9) { //indent:12 exp:12 - System.getProperty("blah"); //indent:12 exp:12 - } else if (8 < 9) { //indent:8 exp:8 - System.getProperty("blah"); //indent:12 exp:12 - } //indent:8 exp:8 - } //indent:4 exp:4 -} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent1.java new file mode 100644 index 00000000000..5d3d4a89c10 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent1.java @@ -0,0 +1,102 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationValidIfIndent1 { //indent:0 exp:0 + + ///// same as above, with statements //indent:4 exp:4 + public void populatedIfTest() //indent:4 exp:4 + { //indent:4 exp:4 + boolean test = false; //indent:8 exp:8 + // no braces if //indent:8 exp:8 + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + + // no braces if/else //indent:8 exp:8 + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + else //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + + + // lcurly on same line, and stmt //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + // lcurly on next line and stmt //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + // lcurly for if and else on same line //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else { //indent:8 exp:8 + System. //indent:12 exp:12 + getProperty("blah"); //indent:16 exp:>=16 + } //indent:8 exp:8 + + // lcurly for if and else on same line //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + else //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + else //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + + // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + // lcurly for if and else on same line -- mixed braces //indent:8 exp:8 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + // lcurly for if and else on same line -- mixed braces, unnested //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + else { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + if (test) System.getProperty("blah"); //indent:8 exp:8 + + } //indent:4 exp:4 + +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent2.java new file mode 100644 index 00000000000..bedf16d3beb --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidIfIndent2.java @@ -0,0 +1,92 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationValidIfIndent2 { //indent:0 exp:0 + + public void populatedIfTest1() //indent:4 exp:4 + { //indent:4 exp:4 + boolean test = false; //indent:8 exp:8 + + if (test) System.getProperty("blah"); //indent:8 exp:8 + else System.getProperty("foo"); //indent:8 exp:8 + + if (test) System.getProperty("blah"); //indent:8 exp:8 + else //indent:8 exp:8 + System.getProperty("foo"); //indent:12 exp:12 + + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + else System.getProperty("foo"); //indent:8 exp:8 + + if (test //indent:8 exp:8 + && 7 < 8 && 8 < 9 //indent:12 exp:12 + && 10 < 11) { //indent:12 exp:12 + } //indent:8 exp:8 + + if (test) //indent:8 exp:8 + return; //indent:12 exp:12 + + + if (test) { //indent:8 exp:8 + } else if (7 < 8) { //indent:8 exp:8 + } else if (8 < 9) { //indent:8 exp:8 + } //indent:8 exp:8 + + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else if (7 < 8) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else if (8 < 9) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + + + if (test) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + else if (7 < 8) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + else if (8 < 9) //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + + + // : bother to support this style? //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else //indent:8 exp:8 + if (7 < 8) { //indent:12 exp:12 + System.getProperty("blah"); //indent:16 exp:16 + } else //indent:12 exp:12 + if (8 < 9) { //indent:16 exp:16 + System.getProperty("blah"); //indent:20 exp:20 + } //indent:16 exp:16 + + } //indent:4 exp:4 + +} //indent:0 exp:0 + +class FooFoo { //indent:0 exp:0 + void foo42() { //indent:4 exp:4 + boolean test = false; //indent:8 exp:8 + if (test) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } else if (7 < 8 //indent:8 exp:8 + && 8 < 9) { //indent:12 exp:12 + System.getProperty("blah"); //indent:12 exp:12 + } else if (8 < 9) { //indent:8 exp:8 + System.getProperty("blah"); //indent:12 exp:12 + } //indent:8 exp:8 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent.java index 2fe6cf13884..de2df7c113a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent.java @@ -53,22 +53,11 @@ public InputIndentationValidMethodIndent(int dummy) //indent:4 exp:4 { //indent:4 exp:4 } //indent:4 exp:4 - // method with rcurly on same line //indent:4 exp:4 - public String method1() { //indent:4 exp:4 - return "hi"; //indent:8 exp:>=8 - } //indent:4 exp:4 - // method with rcurly on next line //indent:4 exp:4 public void method2() //indent:4 exp:4 { //indent:4 exp:4 } //indent:4 exp:4 - // method with a bunch of params //indent:4 exp:4 - public int method2(int x, int y, int w, int h) //indent:4 exp:4 - { //indent:4 exp:4 - return 1; //indent:8 exp:8 - } //indent:4 exp:4 - // params on multiple lines //indent:4 exp:4 public void method2(int x, int y, int w, int h, //indent:4 exp:4 int x1, int y1, int w1, int h1) //indent:8 exp:>=8 @@ -82,110 +71,12 @@ public void method3(int x, int y, int w, int h, //indent:4 exp:4 System.getProperty("foo"); //indent:8 exp:8 } //indent:4 exp:4 - // params on multiple lines //indent:4 exp:4 - public void method4(int x, int y, int w, int h, //indent:4 exp:4 - int x1, int y1, int w1, int h1) //indent:8 exp:8 - { //indent:4 exp:4 - boolean test = true; //indent:8 exp:8 - - int i = 4 + //indent:8 exp:8 - 4; //indent:12 exp:>=12 - - i += 5; //indent:8 exp:8 - i += 5 //indent:8 exp:8 - + 4; //indent:12 exp:>=12 - if (test) //indent:8 exp:8 - { //indent:8 exp:8 - System.getProperty("foo"); //indent:12 exp:12 - } else { //indent:8 exp:8 - System.getProperty("foo"); //indent:12 exp:12 - } //indent:8 exp:8 - - for (int j=0;j<10; j++) { //indent:8 exp:8 - System.getProperty("foo"); //indent:12 exp:12 - } //indent:8 exp:8 - - - myfunc2(10, 10, 10, //indent:8 exp:8 - myfunc3(11, 11, //indent:12 exp:>=12 - 11, 11), //indent:16 exp:>=16 - 10, 10, //indent:12 exp:>=12 - 10); //indent:12 exp:>=12 - - - myfunc3(11, 11, Integer. //indent:8 exp:8 - getInteger("mytest").intValue(), //indent:16 exp:>=12 - 11); //indent:12 exp:>=12 - - myfunc3( //indent:8 exp:8 - 1, //indent:12 exp:>=12 - 2, //indent:12 exp:>=12 - 3, //indent:16 exp:>=12 - 4); //indent:16 exp:>=12 - } //indent:4 exp:4 - // strange IMHO, but I suppose this should be allowed //indent:4 exp:4 public //indent:4 exp:4 void //indent:4 exp:8 warn method5() { //indent:4 exp:8 warn } //indent:4 exp:4 - - private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4 - } //indent:4 exp:4 - - private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4 - return 1; //indent:8 exp:8 - } //indent:4 exp:4 - - - void method6() { //indent:4 exp:4 - System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 - new String[] {"method"}).toString()); //indent:12 exp:>=12 - - System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 - new String[] {"method"} //indent:12 exp:>=12 - ).toString()); //indent:8 exp:8 - - System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 - new String[] {"method"}).toString() //indent:12 exp:>=12 - ); //indent:8 exp:8 - - - myfunc2(3, 4, 5, //indent:8 exp:8 - 6, 7, 8, 9); //indent:12 exp:>=12 - - myfunc2(3, 4, method2(3, 4, 5, 6) + 5, //indent:8 exp:8 - 6, 7, 8, 9); //indent:12 exp:>=12 - - System.identityHashCode("methods are: " + //indent:8 exp:8 - Arrays.asList( //indent:12 exp:>=12 - new String[] {"method"}).toString()); //indent:16 exp:>=16 - - System.identityHashCode("methods are: " //indent:8 exp:8 - + Arrays.asList( //indent:12 exp:>=12 - new String[] {"method"}).toString()); //indent:16 exp:>=16 - - - String blah = (String) System.getProperty( //indent:8 exp:8 - new String("type")); //indent:12 exp:>=12 - - System.identityHashCode(method1() + "mytext" //indent:8 exp:8 - + " at indentation level not at correct indentation, " //indent:12 exp:>=12 - + method1()); //indent:12 exp:>=12 - - System.identityHashCode( //indent:8 exp:8 - method1() + "mytext" //indent:12 exp:>=12 - + " at indentation level not at correct indentation, " //indent:16 exp:>=12 - + method1()); //indent:16 exp:>=12 - - String.CASE_INSENSITIVE_ORDER.toString() //indent:8 exp:8 - .equals("blah"); //indent:12 exp:>=12 - - - - } //indent:4 exp:4 - private int[] getArray() { //indent:4 exp:4 return new int[] {1}; //indent:8 exp:8 } //indent:4 exp:4 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent1.java new file mode 100644 index 00000000000..d229088f05e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/indentation/InputIndentationValidMethodIndent1.java @@ -0,0 +1,120 @@ +package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 + +import java.util.Arrays; //indent:0 exp:0 + +/** //indent:0 exp:0 + * This test-input is intended to be checked using following configuration: //indent:1 exp:1 + * //indent:1 exp:1 + * arrayInitIndent = 4 //indent:1 exp:1 + * basicOffset = 4 //indent:1 exp:1 + * braceAdjustment = 0 //indent:1 exp:1 + * caseIndent = 4 //indent:1 exp:1 + * forceStrictCondition = false //indent:1 exp:1 + * lineWrappingIndentation = 4 //indent:1 exp:1 + * tabWidth = 4 //indent:1 exp:1 + * throwsIndent = 4 //indent:1 exp:1 + * //indent:1 exp:1 + * @author jrichard //indent:1 exp:1 + */ //indent:1 exp:1 +public class InputIndentationValidMethodIndent1 extends Object { //indent:0 exp:0 + + // method with rcurly on same line //indent:4 exp:4 + public String method1() { //indent:4 exp:4 + return "hi"; //indent:8 exp:>=8 + } //indent:4 exp:4 + + // method with a bunch of params //indent:4 exp:4 + public int method2(int x, int y, int w, int h) //indent:4 exp:4 + { //indent:4 exp:4 + return 1; //indent:8 exp:8 + } //indent:4 exp:4 + + // params on multiple lines //indent:4 exp:4 + public void method4(int x, int y, int w, int h, //indent:4 exp:4 + int x1, int y1, int w1, int h1) //indent:8 exp:8 + { //indent:4 exp:4 + boolean test = true; //indent:8 exp:8 + + int i = 4 + //indent:8 exp:8 + 4; //indent:12 exp:>=12 + + i += 5; //indent:8 exp:8 + i += 5 //indent:8 exp:8 + + 4; //indent:12 exp:>=12 + if (test) //indent:8 exp:8 + { //indent:8 exp:8 + System.getProperty("foo"); //indent:12 exp:12 + } else { //indent:8 exp:8 + System.getProperty("foo"); //indent:12 exp:12 + } //indent:8 exp:8 + + for (int j=0;j<10; j++) { //indent:8 exp:8 + System.getProperty("foo"); //indent:12 exp:12 + } //indent:8 exp:8 + + myfunc2(10, 10, 10, //indent:8 exp:8 + myfunc3(11, 11, //indent:12 exp:>=12 + 11, 11), //indent:16 exp:>=16 + 10, 10, //indent:12 exp:>=12 + 10); //indent:12 exp:>=12 + + myfunc3(11, 11, Integer. //indent:8 exp:8 + getInteger("mytest").intValue(), //indent:16 exp:>=12 + 11); //indent:12 exp:>=12 + + myfunc3( //indent:8 exp:8 + 1, //indent:12 exp:>=12 + 2, //indent:12 exp:>=12 + 3, //indent:16 exp:>=12 + 4); //indent:16 exp:>=12 + } //indent:4 exp:4 + + private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4 + } //indent:4 exp:4 + + private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4 + return 1; //indent:8 exp:8 + } //indent:4 exp:4 + + void method6() { //indent:4 exp:4 + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 + new String[] {"method"}).toString()); //indent:12 exp:>=12 + + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 + new String[] {"method"} //indent:12 exp:>=12 + ).toString()); //indent:8 exp:8 + + System.identityHashCode("methods are: " + Arrays.asList( //indent:8 exp:8 + new String[] {"method"}).toString() //indent:12 exp:>=12 + ); //indent:8 exp:8 + + myfunc2(3, 4, 5, //indent:8 exp:8 + 6, 7, 8, 9); //indent:12 exp:>=12 + + myfunc2(3, 4, method2(3, 4, 5, 6) + 5, //indent:8 exp:8 + 6, 7, 8, 9); //indent:12 exp:>=12 + + System.identityHashCode("methods are: " + //indent:8 exp:8 + Arrays.asList( //indent:12 exp:>=12 + new String[] {"method"}).toString()); //indent:16 exp:>=16 + + System.identityHashCode("methods are: " //indent:8 exp:8 + + Arrays.asList( //indent:12 exp:>=12 + new String[] {"method"}).toString()); //indent:16 exp:>=16 + + String blah = (String) System.getProperty( //indent:8 exp:8 + new String("type")); //indent:12 exp:>=12 + + System.identityHashCode(method1() + "mytext" //indent:8 exp:8 + + " at indentation level not at correct indentation, " //indent:12 exp:>=12 + + method1()); //indent:12 exp:>=12 + + System.identityHashCode( //indent:8 exp:8 + method1() + "mytext" //indent:12 exp:>=12 + + " at indentation level not at correct indentation, " //indent:16 exp:>=12 + + method1()); //indent:16 exp:>=12 + + String.CASE_INSENSITIVE_ORDER.toString() //indent:8 exp:8 + .equals("blah"); //indent:12 exp:>=12 + } //indent:4 exp:4 +} //indent:0 exp:0 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCheck1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCheck1.java index 3a30c3ca89f..be33e72b325 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCheck1.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCheck1.java @@ -57,7 +57,7 @@ void inheritDocWithThrows() {} */ public void foo() {} - // violation 5 lines below '

    tag should be preceded with an empty line.' + /** * Some summary. * diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java index 5538b4eea9a..8e874b0b4cc 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java @@ -101,9 +101,6 @@ class InnerInputJavadocParagraphIncorrect { * @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;} // violation 3 lines below 'Empty line should be followed by

    tag on the next line.' diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect3.java index 5af61821493..c7937c879ca 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect3.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect3.java @@ -34,9 +34,6 @@ public class InputJavadocParagraphIncorrect3 { * @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;} // violation 3 lines below 'Empty line should be followed by

    tag on the next line.' diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect4.java index 90b89dc7740..3588f7dface 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect4.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect4.java @@ -28,7 +28,6 @@ public class InputJavadocParagraphIncorrect4 { * *

    testing ok, inline HTML tag. Not a block-level tag */ - // violation 7 lines above 'tag should be preceded with an empty line.' public void foo() {} // violation 4 lines below '

    tag should not precede HTML block-tag ''' diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect5.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect5.java index 8399b893c86..23bb2b26ebe 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect5.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect5.java @@ -9,8 +9,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocparagraph; public class InputJavadocParagraphIncorrect5 { - // violation 3 lines below 'tag should be preceded with an empty line.' - // violation 4 lines below 'tag should be preceded with an empty line.' + /** *

    Testing....

    * @@ -22,14 +21,9 @@ public class InputJavadocParagraphIncorrect5 { * *
    */ - // 2 violations 5 lines above: - // '

    tag should be placed immediately before the first word' - // '

    tag should be preceded with an empty line.' void fooooo() {} - // violation 4 lines below 'tag should be preceded with an empty line.' - // violation 7 lines below 'tag should be preceded with an empty line.' - // violation 12 lines below 'tag should be preceded with an empty line.' + /** *

    testtttt..... * @@ -68,7 +62,6 @@ void foooooo() {} * * */ - // violation 4 lines above 'tag should be preceded with an empty line.' void fooooooo() {} // 2 violations 6 lines below: diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphNested.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphNested.java new file mode 100644 index 00000000000..1a5780c0cb7 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphNested.java @@ -0,0 +1,29 @@ +/* +JavadocParagraph +violateExecutionOnNonTightHtml = (default)false +allowNewlineParagraph = (default)true + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocparagraph; + +/** + * The Tiles taglib and framework allows building + web pages by assembling reusable pieces of pages, + called Tiles. A Tile is usually a simple JSP page. + +

    +

    Introduction

    + +

    The Tiles framework allows building pages + by assembling reusable Tiles. As an example, the page in + the next figure can be built by assembling a + header, a footer, a menu, and a body.

    + +

    doc-files/image001

    +
    + */ +public class InputJavadocParagraphNested { +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameInner.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameInner.java index 7e89dce90f4..235796b6f9a 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameInner.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameInner.java @@ -28,7 +28,7 @@ class InnerInner2 interface InnerInterface2 { // Ignore - should be all upper case - String data = "zxzc"; // violation + String data = "zxzc"; // violation 'Name 'data' must match pattern' // Ignore class InnerInterfaceInnerClass @@ -68,7 +68,7 @@ public static void main() @interface InnerAnnotation { /** Ignore - should be all upper case. */ - String data = "zxzc"; // violation + String data = "zxzc"; // violation 'Name 'data' must match pattern' } /** enum with public member variable */ diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameMemberExtended.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameMemberExtended.java index f80bf911634..8ff6037beaa 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameMemberExtended.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameMemberExtended.java @@ -53,15 +53,15 @@ class Inner { interface In { - public int mPublic = 0; // violation - int mProtected = 0; // violation - int mPackage = 0; // violation - int mPrivate = 0; // violation - - public int _public = 0; // violation - int _protected = 0; // violation - int _package = 0; // violation - int _private = 0; // violation + public int mPublic = 0; // violation 'Name 'mPublic' must match pattern' + int mProtected = 0; // violation 'Name 'mProtected' must match pattern' + int mPackage = 0; // violation 'Name 'mPackage' must match pattern' + int mPrivate = 0; // violation 'Name 'mPrivate' must match pattern' + + public int _public = 0; // violation 'Name '_public' must match pattern' + int _protected = 0; // violation 'Name '_protected' must match pattern' + int _package = 0; // violation 'Name '_package' must match pattern' + int _private = 0; // violation 'Name '_private' must match pattern' } enum Direction { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple1.java index bf2a7e17499..00084790c74 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple1.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple1.java @@ -28,7 +28,7 @@ final class InputConstantNameSimple1 // Name format tests // /** Invalid format **/ - public static final int badConstant = 2; // violation + public static final int badConstant = 2; // violation 'Name 'badConstant' must match pattern' /** Valid format **/ public static final int MAX_ROWS = 2; @@ -145,7 +145,7 @@ void ALL_UPPERCASE_METHOD() } /** test illegal constant **/ - private static final int BAD__NAME = 3; // violation + private static final int BAD__NAME = 3; // violation 'Name 'BAD__NAME' must match pattern' // 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 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple2.java index 6c9704c1ff7..f5f453b4cd7 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/constantname/InputConstantNameSimple2.java @@ -145,7 +145,7 @@ void ALL_UPPERCASE_METHOD() } /** test illegal constant **/ - private static final int BAD__NAME = 3; // violation + private static final int BAD__NAME = 3; // violation 'Name 'BAD__NAME' must match pattern' // 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 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/packagename/InputPackageNameSimple1.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/packagename/InputPackageNameSimple1.java index a97fabd0960..7ace398ff56 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/packagename/InputPackageNameSimple1.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/packagename/InputPackageNameSimple1.java @@ -5,7 +5,8 @@ */ -package com.puppycrawl.tools.checkstyle.checks.naming.packagename; // violation +package com.puppycrawl.tools.checkstyle.checks.naming.packagename; +// violation above 'must match pattern' /** * Contains simple mistakes: diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias4.java new file mode 100644 index 00000000000..c768a370a32 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias4.java @@ -0,0 +1,26 @@ +/* +com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder +aliasList = ConstantNameCheck=constant + +com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilter + +com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck +format = (default)^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$ + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; + +public class InputSuppressWarningsHolderAlias4 { + private static final int a = 0; // violation 'Name 'a' must match pattern' + + @SuppressWarnings("Notconstant") + private static final int b = 0; // violation 'Name 'b' must match pattern' + + @SuppressWarnings("CONSTANT") // filtered violation 'invalid pattern' + private static final int c = 0; + + @SuppressWarnings("CONstant") // filtered violation 'invalid pattern' + private static final int d = 0; +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias5.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias5.java new file mode 100644 index 00000000000..a42ee9cdc74 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias5.java @@ -0,0 +1,44 @@ +/* +com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder +aliasList = ParameterNumber=paramnum + +com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilter + +com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck +max = (default)7 + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; + +public class InputSuppressWarningsHolderAlias5 { + public void needsLotsOfParameters0(int a, // violation 'More than 7 parameters (found 8)' + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + + @SuppressWarnings("paramnum") + public void needsLotsOfParameters(int a, // filtered violation 'max parameter' + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + + @SuppressWarnings("ParamnumUnknown") + public void needsLotsOfParameters2(int a, // violation 'More than 7 parameters (found 8)' + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + + @SuppressWarnings("PAramnuM") + public void needsLotsOfParameters3(int a, // filtered violation 'max parameter' + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + + @SuppressWarnings("PARAMNUM") + public void needsLotsOfParameters4(int a, // filtered violation 'max parameter' + int b, int c, int d, int e, int f, int g, int h) { + // ... + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias6.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias6.java new file mode 100644 index 00000000000..ad0f7404552 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias6.java @@ -0,0 +1,82 @@ +/* +com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder +aliasList = LineLengthCheck=line + +com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilter + +com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck +ignorePattern = ^ *\\* *[^ ]+$ + +com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck +max = 75 + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; + +import static com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck.MSG_KEY; +// violation above, 'Line is longer than 80 characters' + + +public class InputSuppressWarningsHolderAlias6 { + + void testMethod(String str) { + str = MSG_KEY; + System.out.println("This is a short line."); + + System.out.println("This line is long and exceeds the default limit of 80 characters."); + // 2 violations above: + // 'Line is longer than 75 characters' + // 'Line is longer than 80 characters' + } + + @SuppressWarnings("Line") + void testMethod2(String str) { + str = MSG_KEY; + System.out.println("This is a short line."); + + System.out.println("This line is long and exceeds the default limit of 80 characters."); + // filtered 2 violations above: + // 'Line is longer than 75 characters' + // 'Line is longer than 80 characters' + } + + @SuppressWarnings("LIne") + void testMethod3(String str) { + str = MSG_KEY; + System.out.println("This is a short line."); + + System.out.println("This line exceeds the limit of 75 characters."); + // filtered violation above, 'Line is longer than 75 characters' + } + + void testMethod4(String str) { + str = MSG_KEY; + System.out.println("This is a short line."); + + System.out.println("This line exceeds the limit of 75 characters."); + // violation above, 'Line is longer than 75 characters' + } + + // violation 3 lines below 'Line is longer than 75 characters' + /** + * This is a short Javadoc comment. + * ThisJavadocCommentIsAReallyLongWordThatExceedsDefaultLineLimitOfEightyCharacters. + */ + void testMethod5(String str) { + str = MSG_KEY; + System.out.println("This is a short line."); + } + + @SuppressWarnings("LINE") + // filtered violation 3 lines below, 'Line is longer than 75 characters' + /** + * This is a short Javadoc comment. + * ThisJavadocCommentIsAReallyLongWordThatExceedsDefaultLineLimitOfEightyCharacters. + */ + void testMethod6(String str) { + str = MSG_KEY; + System.out.println("This is a short line."); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias7.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias7.java new file mode 100644 index 00000000000..7d8623a26e9 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/suppresswarningsholder/InputSuppressWarningsHolderAlias7.java @@ -0,0 +1,69 @@ +/* +com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder +aliasList = MethodName=name + +com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilter + +com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck +format = ^[A-Z][a-zA-Z0-9]*$ + +com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck +applyToPublic = false + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.suppresswarningsholder; + +public class InputSuppressWarningsHolderAlias7 { + + public void Method1() {} + + @SuppressWarnings("Name") + private void Method2() {} + + private void Method3() {} // violation 'Name 'Method3' must match pattern.' + + @SuppressWarnings("NAme") + protected void Method4() {} + + protected void Method5() {} // violation 'Name 'Method5' must match pattern.' + + @SuppressWarnings("NaMe") + public void method6() {} + + public void method7() {} // violation 'Name 'method7' must match pattern.' + + @SuppressWarnings("NAME") + private void method8() {} + + private void method9() {} // violation 'Name 'method9' must match pattern.' + + @SuppressWarnings("NAME") + protected void method10() {} + + protected void method11() {} // violation 'Name 'method11' must match pattern.' + + public void _methodCheck1() {} + // violation above 'Name '_methodCheck1' must match pattern.' + + @SuppressWarnings("name") + public void _methodCheck2() {} + + private void _methodCheck3() {} + // 2 violations above: + // 'Name '_methodCheck3' must match pattern.' + // 'Name '_methodCheck3' must match pattern.' + + @SuppressWarnings("NAME") + private void _methodCheck4() {} + + protected void _methodCheck5() {} + // 2 violations above: + // 'Name '_methodCheck5' must match pattern.' + // 'Name '_methodCheck5' must match pattern.' + + @SuppressWarnings("Name") + protected void _methodCheck6() {} + +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/ExpectedSarifLoggerSingleErrorColumn0.sarif b/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/ExpectedSarifLoggerSingleErrorColumn0.sarif index 30bb8f90bb9..963c329e914 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/ExpectedSarifLoggerSingleErrorColumn0.sarif +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/ExpectedSarifLoggerSingleErrorColumn0.sarif @@ -24,18 +24,18 @@ { "physicalLocation": { "artifactLocation": { - "uri": "file:Test.java" + "uri": "file:src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/InputSarifLoggerErrorColumn0.java" }, "region": { - "startLine": 1 + "startLine": 13 } } } ], "message": { - "text": "found an error\nplease try again" + "text": "Copyright comment found. \\n try again" }, - "ruleId": "ruleId" + "ruleId": "Copyright comment found. \n try again" } ] } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/InputSarifLoggerErrorColumn0.java b/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/InputSarifLoggerErrorColumn0.java new file mode 100644 index 00000000000..9e967ed980b --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger/InputSarifLoggerErrorColumn0.java @@ -0,0 +1,16 @@ +/*xml + + + + + + + + +*/ + +package com.puppycrawl.tools.checkstyle.sariflogger; +// This code is copyrighted. +public class InputSarifLoggerErrorColumn0 { + +} diff --git a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsHolderExamplesTest.java b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsHolderExamplesTest.java index 82ce0366ede..1a28d690f0a 100644 --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsHolderExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsHolderExamplesTest.java @@ -39,13 +39,13 @@ public void testExample1() throws Exception { final String pattern1 = "^[a-z][a-zA-Z0-9]*$"; final String pattern2 = "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"; final String[] expected = { - "21:15: " + getCheckMessage(MemberNameCheck.class, + "20:15: " + getCheckMessage(MemberNameCheck.class, AbstractNameCheck.MSG_INVALID_PATTERN, "K", pattern1), - "25:28: " + getCheckMessage(ConstantNameCheck.class, + "24:28: " + getCheckMessage(ConstantNameCheck.class, AbstractNameCheck.MSG_INVALID_PATTERN, "i", pattern2), - "35:15: " + getCheckMessage(NoWhitespaceAfterCheck.class, + "34:15: " + getCheckMessage(NoWhitespaceAfterCheck.class, NoWhitespaceAfterCheck.MSG_KEY, "int"), - "35:18: " + getCheckMessage(MemberNameCheck.class, + "34:18: " + getCheckMessage(MemberNameCheck.class, AbstractNameCheck.MSG_INVALID_PATTERN, "ARR", pattern1), }; @@ -63,4 +63,24 @@ public void testExample2() throws Exception { verifyWithInlineConfigParser(getPath("Example2.java"), expected); } + + @Test + public void testExample3() throws Exception { + final String[] expected = { + "18:15: " + getCheckMessage(ParameterNumberCheck.class, + ParameterNumberCheck.MSG_KEY, 7, 8), + }; + + verifyWithInlineConfigParser(getPath("Example3.java"), expected); + } + + @Test + public void testExample4() throws Exception { + final String[] expected = { + "18:15: " + getCheckMessage(ParameterNumberCheck.class, + ParameterNumberCheck.MSG_KEY, 7, 8), + }; + + verifyWithInlineConfigParser(getPath("Example4.java"), expected); + } } diff --git a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterExamplesTest.java b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterExamplesTest.java index 485d37bf66c..d6c8e97c207 100644 --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterExamplesTest.java @@ -31,18 +31,39 @@ protected String getPackageLocation() { @Test public void testExample1() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { + "16:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "19:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "22:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "26:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "32:5: Catching 'Exception' is not allowed.", + "37:5: Catching 'Exception' is not allowed.", + "39:5: Catching 'Error' is not allowed.", + }; + + final String[] expectedWithFilter = { "16:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "22:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "32:5: Catching 'Exception' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example1.java"), expected); + verifyFilterWithInlineConfigParser(getPath("Example1.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample2() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { + "21:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "24:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "27:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "31:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "37:5: Catching 'Exception' is not allowed.", + "42:5: Catching 'Exception' is not allowed.", + "43:5: Catching 'Error' is not allowed.", + }; + + final String[] expectedWithFilter = { "21:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "24:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "27:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", @@ -51,70 +72,136 @@ public void testExample2() throws Exception { "43:5: Catching 'Error' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example2.java"), expected); + verifyFilterWithInlineConfigParser(getPath("Example2.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample3() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { "21:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "24:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "27:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "31:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "38:5: Catching 'Exception' is not allowed.", - "44:5: Catching 'Error' is not allowed.", + "43:5: Catching 'Exception' is not allowed.", + "45:5: Catching 'Error' is not allowed.", + }; + + final String[] expectedWithFilter = { + "21:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "24:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "27:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "31:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "38:5: Catching 'Exception' is not allowed.", + "45:5: Catching 'Error' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example3.java"), expected); + verifyFilterWithInlineConfigParser(getPath("Example3.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample4() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { + "20:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "23:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "26:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "30:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "36:5: Catching 'Exception' is not allowed.", + "41:5: Catching 'Exception' is not allowed.", + "43:5: Catching 'Error' is not allowed.", + }; + + final String[] expectedWithFilter = { "20:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "26:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "36:5: Catching 'Exception' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example4.java"), expected); + verifyFilterWithInlineConfigParser(getPath("Example4.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample5() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { "20:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "23:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "26:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "30:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "37:5: Catching 'Exception' is not allowed.", + "42:5: Catching 'Exception' is not allowed.", + "44:5: Catching 'Error' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example5.java"), expected); + final String[] expectedWithFilter = { + "20:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "26:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "30:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "37:5: Catching 'Exception' is not allowed.", + }; + + verifyFilterWithInlineConfigParser(getPath("Example5.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample6() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { + "25:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "28:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "31:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "35:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "41:5: Catching 'Exception' is not allowed.", + "46:5: Catching 'Exception' is not allowed.", + "48:5: Catching 'Error' is not allowed.", + }; + + final String[] expectedWithFilter = { "25:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "31:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "41:5: Catching 'Exception' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example6.java"), expected); + verifyFilterWithInlineConfigParser(getPath("Example6.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample7() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { "19:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "22:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "25:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "31:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "36:5: Catching 'Exception' is not allowed.", + "40:5: Catching 'Exception' is not allowed.", + "42:5: Catching 'Error' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example7.java"), expected); + final String[] expectedWithFilter = { + "19:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "25:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + }; + + verifyFilterWithInlineConfigParser(getPath("Example7.java"), + expectedWithoutFilter, expectedWithFilter); } @Test public void testExample8() throws Exception { - final String[] expected = { + final String[] expectedWithoutFilter = { + "18:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "21:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "24:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "28:27: Name 'var4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "34:5: Catching 'Exception' is not allowed.", + "39:5: Catching 'Exception' is not allowed.", + "40:5: Catching 'Error' is not allowed.", + }; + + final String[] expectedWithFilter = { "18:7: Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "21:7: Name 'VAR2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "24:27: Name 'var3' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", @@ -123,6 +210,7 @@ public void testExample8() throws Exception { "40:5: Catching 'Error' is not allowed.", }; - verifyWithInlineConfigParser(getPath("Example8.java"), expected); + verifyFilterWithInlineConfigParser(getPath("Example8.java"), + expectedWithoutFilter, expectedWithFilter); } } diff --git a/src/xdocs-examples/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/Example1.java b/src/xdocs-examples/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/Example1.java index 5e0dde05f0d..49f2d5c0e37 100644 --- a/src/xdocs-examples/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/Example1.java +++ b/src/xdocs-examples/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/covariantequals/Example1.java @@ -10,12 +10,12 @@ // xdoc section -- start public class Example1 { - public boolean equals(Example1 same) { // violation + public boolean equals(Example1 same) { // violation 'covariant equals' return false; } record Test(String str) { - public boolean equals(Test same) { // violation + public boolean equals(Test same) { // violation 'covariant equals' return false; } } diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example1.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example1.java index b6d75032e6e..677f7cc7512 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example1.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example1.java @@ -1,14 +1,13 @@ /*xml - - - - - - - + + + + + + + diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example2.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example2.java index cf67c92f2db..16ad0a2d1b1 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example2.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example2.java @@ -1,11 +1,11 @@ /*xml - - - - + + + + diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example3.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example3.java new file mode 100644 index 00000000000..2606f1ef1a1 --- /dev/null +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example3.java @@ -0,0 +1,30 @@ +/*xml + + + + + + + + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarningsholder; + +// xdoc section -- start +public class Example3 { + // violation below, 'More than 7 parameters (found 8)' + public void needsLotsOfParameters (int a, + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + + @SuppressWarnings("paramnum") + public void needsLotsOfParameters1 (int a, // violation suppressed + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + +} +// xdoc section -- end diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example4.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example4.java new file mode 100644 index 00000000000..564e7e06a16 --- /dev/null +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/annotation/suppresswarningsholder/Example4.java @@ -0,0 +1,30 @@ +/*xml + + + + + + + + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarningsholder; + +// xdoc section -- start +public class Example4 { + // violation below, 'More than 7 parameters (found 8)' + public void needsLotsOfParameters (int a, + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + + @SuppressWarnings("paramnum") + public void needsLotsOfParameters1 (int a, // violation suppressed + int b, int c, int d, int e, int f, int g, int h) { + // ... + } + +} +// xdoc section -- end diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example1.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example1.java index 7e4e3c6be0a..454a438d1d8 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example1.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example1.java @@ -16,14 +16,14 @@ class Example1 int VAR1; // violation, Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$' //CHECKSTYLE:OFF - int VAR2; // suppressed violation + int VAR2; // filtered violation 'must match pattern' //CHECKSTYLE:ON public static final int var3 = 1; // violation above, 'must match pattern' //CHECKSTYLE:OFF - public static final int var4 = 1; // suppressed violation + public static final int var4 = 1; // filtered violation 'must match pattern' //CHECKSTYLE:ON public void method1() @@ -34,8 +34,10 @@ public void method1() //CHECKSTYLE:OFF try {} - catch(Exception ex) {} // suppressed violation - catch(Error err) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' + catch(Error err) {} + // filtered violation above 'Catching 'Error' is not allowed' //CHECKSTYLE:ON } diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example2.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example2.java index 66cc307dcd4..61bdacbf84f 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example2.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example2.java @@ -28,7 +28,7 @@ class Example2 // violation above, Name 'must match pattern' //stop constant check - public static final int var4 = 1; // suppressed violation + public static final int var4 = 1; // filtered violation 'must match pattern' //resume constant check public void method1() diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example3.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example3.java index 4943a9be5d0..1244a8b195f 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example3.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example3.java @@ -40,7 +40,8 @@ public void method1() //ILLEGAL OFF: Exception try {} - catch(Exception ex) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' catch(Error err) {} // violation, Catching 'Error' is not allowed //ILLEGAL ON: Exception diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example4.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example4.java index e093faf6b44..837a9eb291f 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example4.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example4.java @@ -20,14 +20,14 @@ class Example4 int VAR1; // violation, Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$' //CSOFF: MemberName - int VAR2; // suppressed violation + int VAR2; // filtered violation 'must match pattern' //CSON: MemberName public static final int var3 = 1; // violation above, 'must match pattern' //CSOFF: ConstantName - public static final int var4 = 1; // suppressed violation + public static final int var4 = 1; // filtered violation 'must match pattern' //CSON: ConstantName public void method1() @@ -38,8 +38,10 @@ public void method1() //CSOFF: IllegalCatch try {} - catch(Exception ex) {} // suppressed violation - catch(Error err) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' + catch(Error err) {} + // filtered violation above 'Catching 'Error' is not allowed' //CSON: IllegalCatch } diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example5.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example5.java index 4d629a65714..7a1d9af749b 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example5.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example5.java @@ -20,7 +20,7 @@ class Example5 int VAR1; // violation, Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$' //CHECKSTYLE_OFF: ALMOST_ALL - int VAR2; // suppressed violation + int VAR2; // filtered violation 'must match pattern' //CHECKSTYLE_ON: ALMOST_ALL public static final int var3 = 1; @@ -39,8 +39,10 @@ public void method1() //CHECKSTYLE_OFF: ALMOST_ALL try {} - catch(Exception ex) {} // suppressed violation - catch(Error err) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' + catch(Error err) {} + // filtered violation above 'Catching 'Error' is not allowed' //CHECKSTYLE_ON: ALMOST_ALL } diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example6.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example6.java index eb69cca8b91..bc02ebfe754 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example6.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example6.java @@ -25,14 +25,14 @@ class Example6 int VAR1; // violation, Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$' //CSOFF MemberID - int VAR2; // suppressed violation + int VAR2; // filtered violation 'must match pattern' //CSON: MemberID public static final int var3 = 1; // violation above, 'must match pattern' //CSOFF ConstantID - public static final int var4 = 1; // suppressed violation + public static final int var4 = 1; // filtered violation 'must match pattern' //CSON ConstantID public void method1() @@ -43,8 +43,10 @@ public void method1() //CSOFF IllegalID try {} - catch(Exception ex) {} // suppressed violation - catch(Error err) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' + catch(Error err) {} + // filtered violation above 'Catching 'Error' is not allowed' //CSON IllegalID } diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example7.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example7.java index 1ee1470a854..3f1d429d4e8 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example7.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example7.java @@ -19,7 +19,7 @@ class Example7 int VAR1; // violation, Name 'VAR1' must match pattern '^[a-z][a-zA-Z0-9]*$' //csoff MemberName - int VAR2; // suppressed violation + int VAR2; // filtered violation 'must match pattern' //cson MemberName public static final int var3 = 1; @@ -28,16 +28,19 @@ class Example7 //csoff ConstantName //csoff IllegalCatch - public static final int var4 = 1; // suppressed violation + public static final int var4 = 1; // filtered violation 'must match pattern' public void method1() { try {} - catch(Exception ex) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' try {} - catch(Exception ex) {} // suppressed violation - catch(Error err) {} // suppressed violation + catch(Exception ex) {} + // filtered violation above 'Catching 'Exception' is not allowed' + catch(Error err) {} + // filtered violation above 'Catching 'Error' is not allowed' } //cson ConstantName diff --git a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example8.java b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example8.java index f0677c7725f..f4c371abf55 100644 --- a/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example8.java +++ b/src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/Example8.java @@ -25,7 +25,7 @@ class Example8 // violation above, Name 'must match pattern' /*CHECKSTYLE:OFF*/ - public static final int var4 = 1; // suppressed violation + public static final int var4 = 1; // filtered violation 'must match pattern' /*CHECKSTYLE:ON*/ public void method1()