mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
ee3cf8cc09
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
28 lines
939 B
Diff
28 lines
939 B
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 23 Feb 2019 11:26:21 -0500
|
|
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..0000000000000000000000000000000000000000
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java
|
|
@@ -0,0 +0,0 @@
|
|
+package com.destroystokyo.paper.util;
|
|
+
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+public class SneakyThrow {
|
|
+
|
|
+ public static void sneaky(@NotNull Throwable exception) {
|
|
+ SneakyThrow.<RuntimeException>throwSneaky(exception);
|
|
+ }
|
|
+
|
|
+ @SuppressWarnings("unchecked")
|
|
+ private static <T extends Throwable> void throwSneaky(@NotNull Throwable exception) throws T {
|
|
+ throw (T) exception;
|
|
+ }
|
|
+
|
|
+}
|