diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/MethodLeftCurlyCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/MethodLeftCurlyCheck.java index d490ad587..6fd3e4bd8 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/MethodLeftCurlyCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/MethodLeftCurlyCheck.java @@ -23,7 +23,29 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** + *

* Checks the placement of left curly braces on methods. + * The policy to verify is specified using the {@link + * LeftCurlyOption} class and defaults to {@link LeftCurlyOption#EOL}. Policies + * {@link LeftCurlyOption#EOL} and {@link LeftCurlyOption#NLOW} take into + * account property maxLineLength. The default value for maxLineLength is 80. + *

+ *

+ * An example of how to configure the check is: + *

+ *
+ * <config name="MethodLeftCurlyCheck"/>
+ * 
+ *

+ * An example of how to configure the check with policy + * {@link LeftCurlyOption#NLOW} and maxLineLength 120 is: + *

+ *
+ * <config name="MethodLeftCurlyCheck">
+ *     <property name="option" value="nlow"/>
+ *     <property name="maxLineLength" value="120"/>
+ * </config>
+ * 
* * @author Oliver Burn * @version 1.0 diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/OtherLeftCurlyCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/OtherLeftCurlyCheck.java index 7bc68eb09..f9077072f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/OtherLeftCurlyCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/OtherLeftCurlyCheck.java @@ -23,8 +23,55 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.api.DetailAST; /** - * Checks the placement of left curly braces on other constructs apart from + *

+ * Checks the placement of left curly braces on other blocks apart from * methods and types. + *

+ *

By default the check will check the following blocks: + * {@link TokenTypes#LITERAL_CATCH LITERAL_CATCH}, + * {@link TokenTypes#LITERAL_DO LITERAL_DO}, + * {@link TokenTypes#LITERAL_ELSE LITERAL_ELSE}, + * {@link TokenTypes#LITERAL_FINALLY LITERAL_FINALLY}, + * {@link TokenTypes#LITERAL_FOR LITERAL_FOR}, + * {@link TokenTypes#LITERAL_IF LITERAL_IF}, + * {@link TokenTypes#LITERAL_SWITCH LITERAL_SWITCH}, + * {@link TokenTypes#LITERAL_SYNCHRONIZED LITERAL_SYNCHRONIZED}, + * {@link TokenTypes#LITERAL_TRY LITERAL_TRY}, + * {@link TokenTypes#LITERAL_WHILE LITERAL_WHILE}. + *

+ *

+ * The policy to verify is specified using the {@link + * LeftCurlyOption} class and defaults to {@link LeftCurlyOption#EOL}. Policies + * {@link LeftCurlyOption#EOL} and {@link LeftCurlyOption#NLOW} take into + * account property maxLineLength. The default value for maxLineLength is 80. + *

+ *

+ * An example of how to configure the check is: + *

+ *
+ * <config name="OtherLeftCurlyCheck"/>
+ * 
+ *

+ * An example of how to configure the check with policy + * {@link LeftCurlyOption#NLOW} and maxLineLength 120 is: + *

+ *
+ * <config name="OtherLeftCurlyCheck">
+ *     <property name="option" value="nlow"/>
+ *     <property name="maxLineLength" value="120"/>
+ * </config>
+ * 
+ *

+ * An example of how to configure the check with policy + * {@link LeftCurlyOption#NL} for if and else blocks + * is: + *

+ *
+ * <config name="OtherLeftCurlyCheck">
+ *     <property name="option" value="nl"/>
+ *     <property name="tokens" value="LITERAL_IF, LITERAL_ELSE"/>
+ * </config>
+ * 
* * @author Oliver Burn * @author lkuehne diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheck.java index efa7c0b02..1776ddd8f 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheck.java @@ -22,8 +22,29 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** + *

* Checks the placement of left curly braces on types. - * + * The policy to verify is specified using the {@link + * LeftCurlyOption} class and defaults to {@link LeftCurlyOption#EOL}. Policies + * {@link LeftCurlyOption#EOL} and {@link LeftCurlyOption#NLOW} take into + * account property maxLineLength. The default value for maxLineLength is 80. + *

+ *

+ * An example of how to configure the check is: + *

+ *
+ * <config name="TypeLeftCurlyCheck"/>
+ * 
+ *

+ * An example of how to configure the check with policy + * {@link LeftCurlyOption#NLOW} and maxLineLength 120 is: + *

+ *
+ * <config name="TypeLeftCurlyCheck">
+ *     <property name="option" value="nlow"/>
+ *     <property name="maxLineLength" value="120"/>
+ * </config>
+ * 
* @author Oliver Burn * @author lkuehne * @version 1.0