aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation
diff options
context:
space:
mode:
authorVladislav Lisetskiy <vladlis54@gmail.com>2016-06-12 17:50:31 +0400
committerRoman Ivanov <romani@users.noreply.github.com>2016-06-12 06:50:31 -0700
commit43839b3d7107417095b5b915064e7dcf39e3b2b1 (patch)
tree955d20fe7bdd909cf12549372c39ea18428ce807 /src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation
parent490128302232d627388fc5f0023e00ec18b7939c (diff)
downloadcheckstyle-43839b3d7107417095b5b915064e7dcf39e3b2b1.tar.gz
Issue #3220: CommentsIndentation: allow upper comments for following block at multi-block structures (#3270)
Diffstat (limited to 'src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation')
-rw-r--r--src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInMultiblockStructures.java131
1 files changed, 131 insertions, 0 deletions
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInMultiblockStructures.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInMultiblockStructures.java
new file mode 100644
index 000000000..ef5388451
--- /dev/null
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationInMultiblockStructures.java
@@ -0,0 +1,131 @@
+package com.puppycrawl.tools.checkstyle.checks.indentation;
+
+public class InputCommentsIndentationInMultiblockStructures {
+ void foo() {
+ if (true) {
+ assert true;
+ // comment for else
+ } else {}
+
+ if (true) {
+ assert true;
+ // violation
+ }
+ else {}
+
+ if (true) {
+ assert true;
+ // violation
+ } else {}
+
+ if (true) {
+ assert true;
+// violation
+ } else {}
+
+ try {
+ assert true;
+ // comment for catch
+ } catch (Exception ex) {}
+
+ try {
+ assert true;
+ // violation
+ }
+ catch (Exception ex) {}
+
+ try {
+ assert true;
+// violation
+ } catch (Exception ex) {}
+
+ try {
+ assert true;
+ // violation
+ } catch (Exception ex) {}
+
+ try {
+ assert true;
+ // comment for finally
+ } finally {}
+
+ try {
+ assert true;
+ // violation
+ }
+ finally {}
+
+ try {
+ assert true;
+// violation
+ } finally {}
+
+ try {
+ assert true;
+ // violation
+ } finally {}
+
+ try {} catch (Exception ex) {
+ assert true;
+ // comment for finally
+ } finally {}
+
+ try {} catch (Exception ex) {
+ assert true;
+ // violation
+ }
+ finally {}
+
+ try {} catch (Exception ex) {
+ assert true;
+// violation
+ } finally {}
+
+ try {} catch (Exception ex) {
+ assert true;
+ // violation
+ } finally {}
+
+ try {} catch (ClassCastException ex) {
+ assert true;
+ // comment for catch
+ } catch (Exception ex) {}
+
+ try {} catch (ClassCastException ex) {
+ assert true;
+ // violation
+ }
+ catch (Exception ex) {}
+
+ try {} catch (ClassCastException ex) {
+ assert true;
+// violation
+ } catch (Exception ex) {}
+
+ try {} catch (ClassCastException ex) {
+ assert true;
+ // violation
+ } catch (Exception ex) {}
+
+ do {
+ assert true;
+ // comment for while
+ } while (false);
+
+ do {
+ assert true;
+ // violation
+ }
+ while (false);
+
+ do {
+ assert true;
+ // violation
+ } while (false);
+
+ do {
+ assert true;
+// violation
+ } while (false);
+ }
+}