diff --git a/paper-api/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java b/paper-api/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java new file mode 100644 index 0000000000..fbcd82b513 --- /dev/null +++ b/paper-api/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java @@ -0,0 +1,19 @@ +package com.destroystokyo.paper.util; + +import org.jetbrains.annotations.ApiStatus; +import org.jspecify.annotations.NullMarked; + +@ApiStatus.Internal +@NullMarked +public final class SneakyThrow { + + public static void sneaky(final Throwable exception) { + SneakyThrow.throwSneaky(exception); + } + + @SuppressWarnings("unchecked") + private static void throwSneaky(final Throwable exception) throws T { + throw (T) exception; + } + +}