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