diff options
author | Vladislav Lisetskii <vladislav_lisetskii@epam.com> | 2017-03-26 20:20:58 +0300 |
---|---|---|
committer | rnveach <rveach02@gmail.com> | 2017-04-05 08:56:17 -0400 |
commit | fbbca731e303814de9081fd1e39a440f4a804299 (patch) | |
tree | 655b3c95c259afad99e68790575a8e08aa35546b /src | |
parent | 5ad11eb03614f088687e9f2730406c484826d43b (diff) | |
download | checkstyle-fbbca731e303814de9081fd1e39a440f4a804299.tar.gz |
Issue #4085: Extend documentation for RightCurlyOption.SAME
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java | 9 | ||||
-rw-r--r-- | src/xdocs/property_types.xml | 7 |
2 files changed, 15 insertions, 1 deletions
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. * * <p>Examples:</p> * @@ -117,6 +118,12 @@ public enum RightCurlyOption { * ... * <b>}</b> // this is NOT OK, not on the same line as the next part of a multi-block statement * <b>}</b>); // this is OK, allowed for better code readability + * + * if (a > 0) { ... <b>}</b> // OK, single-line multi-block statement + * if (a > 0) { ... } else { ... <b>}</b> // OK, single-line multi-block statement + * if (a > 0) { + * ... + * } else { ... <b>}</b> // OK, single-line multi-block statement * </pre> **/ 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 @@ <td> 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. <p>Examples:</p> @@ -346,6 +347,12 @@ ... <b>}</b> // this is NOT OK, brace is not on the same line as the next part of a multi-block statement <b>}</b>); // this is OK, allowed for better code readability + + if (a > 0) { ... <b>}</b> // OK, single-line multi-block statement + if (a > 0) { ... } else { ... <b>}</b> // OK, single-line multi-block statement + if (a > 0) { + ... + } else { ... <b>}</b> // OK, single-line multi-block statement </pre> </td> </tr> |