diff options
author | jack870131 <jack870131@outlook.com> | 2018-09-19 22:16:36 +0100 |
---|---|---|
committer | rnveach <rveach02@gmail.com> | 2018-09-19 20:43:04 -0400 |
commit | 27512b0acc3ad3cb4e28306d4f8936b9108c5bca (patch) | |
tree | 0e1f7635d1c94068d9162b57a8b5ec5c9d8c3505 | |
parent | ecaa42035e4637106d442562cc151f9ec6d5a854 (diff) | |
download | checkstyle-mirror-upstream-master.tar.gz |
Issue #5832: Add javadoc and xdoc Example for CatchParameterNamemirror-upstream-master
-rw-r--r-- | src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java | 21 | ||||
-rw-r--r-- | src/xdocs/config_naming.xml | 20 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java index 9871c01ac..e3530fe13 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java @@ -56,12 +56,31 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; * An example of how to configure the check for names that begin with a lower case letter, * followed by any letters or digits is: * </p> + * <p>Configuration:</p> * <pre> * <module name="CatchParameterName"> * <property name="format" value="^[a-z][a-zA-Z0-9]+$"/> * </module> * </pre> - * + * <p>Example:</p> + * <pre> + * public class MyTest { + * public void myTest() { + * try { + * // ... + * } catch (ArithmeticException ex) { //OK + * // ... + * } catch (ArrayIndexOutOfBoundsException ex2) { //OK + * // ... + * } catch (IOException thirdException) { //OK + * // ... + * } catch (Exception FourthException) { // violation, the initial letter + * // should be lowercase + * // ... + * } + * } + * } + * </pre> * @since 6.14 */ public class CatchParameterNameCheck extends AbstractNameCheck { diff --git a/src/xdocs/config_naming.xml b/src/xdocs/config_naming.xml index ec6ea1ced..71bd1edbb 100644 --- a/src/xdocs/config_naming.xml +++ b/src/xdocs/config_naming.xml @@ -376,11 +376,31 @@ class AbstractThirdClass {} // OK, no "abstract" modifier An example of how to configure the check for names that begin with a lower case letter, followed by any letters or digits is: </p> + <p>Configuration:</p> <source> <module name="CatchParameterName"> <property name="format" value="^[a-z][a-zA-Z0-9]+$"/> </module> </source> + <p>Example:</p> + <pre> +public class MyTest { + public void myTest() { + try { + // ... + } catch (ArithmeticException ex) { //OK + // ... + } catch (ArrayIndexOutOfBoundsException ex2) { //OK + // ... + } catch (IOException thirdException) { //OK + // ... + } catch (Exception FourthException) { // violation, the initial letter + // should be lowercase + // ... + } + } +} + </pre> </subsection> <subsection name="Example of Usage" id="CatchParameterName_Example_of_Usage"> |