1
2
3
4
5 package mockit.internal.reflection;
6
7 import edu.umd.cs.findbugs.annotations.NonNull;
8
9 @SuppressWarnings("UtilityClassWithoutPrivateConstructor")
10 final class ThrowOfCheckedException {
11 private static Exception exceptionToThrow;
12
13 ThrowOfCheckedException() throws Exception {
14 throw exceptionToThrow;
15 }
16
17 @SuppressWarnings("deprecation")
18 static synchronized void doThrow(@NonNull Exception checkedException) {
19 exceptionToThrow = checkedException;
20 try {
21 ThrowOfCheckedException.class.newInstance();
22 } catch (InstantiationException | IllegalAccessException ignore) {
23 }
24 }
25 }