From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 18 Dec 2020 20:59:25 -0600 Subject: [PATCH] Remove paper's unsafe util diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java index beed9e6e07a9080f1c059e08220839090553d0a4..f79685b48bb581277a6891927988b6f7a4389dc4 100644 --- a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java +++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java @@ -1,6 +1,5 @@ package com.destroystokyo.paper.event.executor.asm; -import com.destroystokyo.paper.utils.UnsafeUtils; import org.jetbrains.annotations.NotNull; public interface ClassDefiner { diff --git a/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java b/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java deleted file mode 100644 index 72e48e8efdf750d77fc1f9d5fa7dc279e88aa9a7..0000000000000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/utils/UnsafeUtils.java +++ /dev/null @@ -1,35 +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; - } -}