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