From fbbca731e303814de9081fd1e39a440f4a804299 Mon Sep 17 00:00:00 2001 From: Vladislav Lisetskii Date: Sun, 26 Mar 2017 20:20:58 +0300 Subject: Issue #4085: Extend documentation for RightCurlyOption.SAME --- .../tools/checkstyle/checks/blocks/RightCurlyOption.java | 9 ++++++++- src/xdocs/property_types.xml | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java index 85130f585..ea481209f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java @@ -64,7 +64,8 @@ public enum RightCurlyOption { /** * Represents the policy that the brace should be on the same line as the * the next part of a multi-block statement (one that directly contains - * multiple blocks: if/else-if/else or try/catch/finally). + * multiple blocks: if/else-if/else or try/catch/finally). It also allows + * single-line format of multi-block statements. * *

Examples:

* @@ -117,6 +118,12 @@ public enum RightCurlyOption { * ... * } // this is NOT OK, not on the same line as the next part of a multi-block statement * }); // this is OK, allowed for better code readability + * + * if (a > 0) { ... } // OK, single-line multi-block statement + * if (a > 0) { ... } else { ... } // OK, single-line multi-block statement + * if (a > 0) { + * ... + * } else { ... } // OK, single-line multi-block statement * **/ SAME diff --git a/src/xdocs/property_types.xml b/src/xdocs/property_types.xml index 691656929..2951579dd 100644 --- a/src/xdocs/property_types.xml +++ b/src/xdocs/property_types.xml @@ -294,6 +294,7 @@ The brace should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else or try/catch/finally). + It also allows single-line format of multi-block statements.

Examples:

@@ -346,6 +347,12 @@ ... } // this is NOT OK, brace is not on the same line as the next part of a multi-block statement }); // this is OK, allowed for better code readability + + if (a > 0) { ... } // OK, single-line multi-block statement + if (a > 0) { ... } else { ... } // OK, single-line multi-block statement + if (a > 0) { + ... + } else { ... } // OK, single-line multi-block statement -- cgit v1.2.3