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
use new;
use ;
/// What an exception handler catches, resolved from the `catch_type` index of an
/// `exception_table` entry (JVMS §4.7.3).
/// An `exception_table` entry of a `Code` attribute (JVMS §4.7.3), with `catch_type` already
/// resolved from a constant-pool index.
///
/// This carries the data only. Deciding whether a record actually handles a given throwable needs
/// the loaded-class graph (to test assignability), so that logic belongs to the consumer:
///
/// ```
/// use jclassmodel::CatchType;
/// # fn is_assignable(_: &str, _: &str) -> bool { true }
/// # let (record_catch_type, thrown) = (CatchType::Any, "java/io/IOException");
/// let handles = match &record_catch_type {
/// CatchType::Any => true,
/// CatchType::Class(name) => is_assignable(thrown, name),
/// };
/// # assert!(handles);
/// ```