-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Example1.txt
43 lines (35 loc) · 908 Bytes
/
Example1.txt
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
/*xml
<module name="Checker">
<module name="TreeWalker">
<module name="MutableException"/>
</module>
</module>
*/
// xdoc section -- start
class FirstClass extends Exception {
private int code; // OK, class name doesn't match with default pattern
public FirstClass() {
code = 1;
}
}
class MyException extends Exception {
private int code; // violation, The field 'code' must be declared final
public MyException() {
code = 2;
}
}
class MyThrowable extends Throwable {
final int code; // OK
String message; // violation, The field 'message' must be declared final
public MyThrowable(int code, String message) {
this.code = code;
this.message = message;
}
}
class BadException extends java.lang.Exception {
int code; // violation, The field 'code' must be declared final
public BadException(int code) {
this.code = code;
}
}
// xdoc section -- end