geforkt von Mirrors/Paper
Remove Paper's UnsafeUtils (#4913)
Dieser Commit ist enthalten in:
Ursprung
3ce9dfed51
Commit
57c5f5e566
@ -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
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren