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