From 57c5f5e566e30078313157e00a0222450070bba6 Mon Sep 17 00:00:00 2001 From: MiniDigger | Martin Date: Sat, 19 Dec 2020 21:14:37 +0100 Subject: [PATCH] Remove Paper's UnsafeUtils (#4913) --- .../Use-ASM-for-event-executors.patch | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/Spigot-API-Patches/Use-ASM-for-event-executors.patch b/Spigot-API-Patches/Use-ASM-for-event-executors.patch index 602d2ebef2..43317f6b55 100644 --- a/Spigot-API-Patches/Use-ASM-for-event-executors.patch +++ b/Spigot-API-Patches/Use-ASM-for-event-executors.patch @@ -185,7 +185,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.event.executor.asm; + -+import com.destroystokyo.paper.utils.UnsafeUtils; +import org.jetbrains.annotations.NotNull; + +public interface ClassDefiner { @@ -290,47 +289,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java b/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper.utils; -+ -+import org.jetbrains.annotations.Nullable; -+import sun.misc.Unsafe; -+ -+import java.lang.reflect.Field; -+ -+public class UnsafeUtils { -+ private UnsafeUtils() {} -+ -+ private static final Unsafe UNSAFE; -+ static { -+ Unsafe unsafe; -+ try { -+ Class c = Class.forName("sun.misc.Unsafe"); -+ Field f = c.getDeclaredField("theUnsafe"); -+ f.setAccessible(true); -+ unsafe = (Unsafe) f.get(null); -+ } catch (ClassNotFoundException | NoSuchFieldException | SecurityException e) { -+ unsafe = null; -+ } catch (IllegalAccessException e) { -+ throw new AssertionError(e); -+ } -+ UNSAFE = unsafe; -+ } -+ -+ public static boolean isUnsafeSupported() { -+ return UNSAFE != null; -+ } -+ -+ @Nullable -+ public static Unsafe getUnsafe() { -+ return UNSAFE; -+ } -+} diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/plugin/EventExecutor.java