Finish converting all events to jspecify annotations

This commit is contained in:
Jake Potrebic 2024-09-29 16:48:34 -07:00
parent ea00be3aaa
commit ba3c29b92e
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
82 changed files with 977 additions and 1103 deletions

View file

@ -6,22 +6,25 @@ Subject: [PATCH] Paper Utils
diff --git a/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
new file mode 100644
index 0000000000000000000000000000000000000000..9db0056ab94145819628b3ad8d8d26130d117fcf
index 0000000000000000000000000000000000000000..fbcd82b513b4cb9839f9d2b38d9c6c73148e30a6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
@@ -0,0 +1,16 @@
@@ -0,0 +1,19 @@
+package com.destroystokyo.paper.util;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
+
+public class SneakyThrow {
+@ApiStatus.Internal
+@NullMarked
+public final class SneakyThrow {
+
+ public static void sneaky(@NotNull Throwable exception) {
+ SneakyThrow.<RuntimeException>throwSneaky(exception);
+ public static void sneaky(final Throwable exception) {
+ SneakyThrow.throwSneaky(exception);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends Throwable> void throwSneaky(@NotNull Throwable exception) throws T {
+ private static <T extends Throwable> void throwSneaky(final Throwable exception) throws T {
+ throw (T) exception;
+ }
+