View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="MutableException">
5         <property name="extendedClassNameFormat" value="^.*Throwable$"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.design.mutableexception;
12  
13  // xdoc section -- start
14  class Example3 extends Exception {
15    private int code; // OK, extended class name doesn't match with given pattern
16  
17    public Example3() {
18      code = 1;
19    }
20  }
21  
22  class ThirdException extends Exception {
23    private int code; // OK, extended class name doesn't match with given pattern
24  
25    public ThirdException() {
26      code = 2;
27    }
28  }
29  
30  class ThirdThrowable extends Throwable {
31    final int code; // OK
32    String message; // violation
33  
34    public ThirdThrowable(int code, String message) {
35      this.code = code;
36      this.message = message;
37    }
38  }
39  
40  class ThirdBadException extends java.lang.Exception {
41    int code; // OK, extended class name doesn't match with given pattern
42  
43    public ThirdBadException(int code) {
44      this.code = code;
45    }
46  }
47  // xdoc section -- end