1
2
3
4
5
6 package mockit.asm.exceptionHandling;
7
8 import edu.umd.cs.findbugs.annotations.NonNull;
9 import edu.umd.cs.findbugs.annotations.Nullable;
10
11 import mockit.asm.controlFlow.Label;
12 import mockit.asm.util.ByteVector;
13
14 import org.checkerframework.checker.index.qual.NonNegative;
15
16
17
18
19 final class ExceptionHandler {
20
21
22
23 @NonNull
24 final Label start;
25
26
27
28
29 @NonNull
30 final Label end;
31
32
33
34
35 @NonNull
36 final Label handler;
37
38
39
40
41 @Nullable
42 private final String desc;
43
44
45
46
47
48 @NonNegative
49 private final int type;
50
51 ExceptionHandler(@NonNull Label start, @NonNull Label end, @NonNull Label handler, @Nullable String desc,
52 @NonNegative int type) {
53 this.start = start;
54 this.end = end;
55 this.handler = handler;
56 this.desc = desc;
57 this.type = type;
58 }
59
60 @NonNull
61 String getCatchTypeDesc() {
62 return desc == null ? "java/lang/Throwable" : desc;
63 }
64
65 void put(@NonNull ByteVector out) {
66 out.putShort(start.position).putShort(end.position).putShort(handler.position).putShort(type);
67 }
68 }