aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0208-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches/0208-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch')
-rw-r--r--Spigot-Server-Patches/0208-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0208-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch b/Spigot-Server-Patches/0208-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch
new file mode 100644
index 0000000000..ad3efa1f54
--- /dev/null
+++ b/Spigot-Server-Patches/0208-Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch
@@ -0,0 +1,30 @@
+From 5e1b6f44000755e1b473737e27c13fdc6a2a46a6 Mon Sep 17 00:00:00 2001
+From: Brokkonaut <[email protected]>
+Date: Fri, 20 Oct 2017 04:33:45 +0200
+Subject: [PATCH] Replace HashSet with fastutil's ObjectOpenHashSet in
+ HashTreeSet
+
+HashSet sometimes uses compareTo() instead of equals() and this breaks the comparison of net.minecraft.server.NextTickListEntry (the only place where HashTreeSet is used).
+
+In this cases duplicate entries could be added to the HashSet of HashTreeSet, because NextTickListEntry.compareTo() does not return 0, even if NextTickListEntry.equals() returns true.
+
+ObjectOpenHashSet never uses compareTo(), so the inconsistencies of NextTickListEntry cause no problems.
+
+Fixes https://github.com/PaperMC/Paper/issues/588
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java
+index 80a5c29f3b..cd864c4047 100644
+--- a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java
++++ b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java
+@@ -8,7 +8,7 @@ import java.util.TreeSet;
+
+ public class HashTreeSet<V> implements Set<V> {
+
+- private HashSet<V> hash = new HashSet<V>();
++ private Set<V> hash = new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<V>(); //Paper - Replace java.util.HashSet with ObjectOpenHashSet
+ private TreeSet<V> tree = new TreeSet<V>();
+
+ public HashTreeSet() {
+--
+2.21.0
+