From 5b53cb404dd798b4346593cf4b65b41b7762ce7e Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 24 Nov 2024 19:26:32 -0800 Subject: [PATCH] [ci skip] use more jspecify in server --- ...gistryAccess-for-managing-Registries.patch | 91 +++++----- .../0992-Registry-Modification-API.patch | 157 +++++++++--------- ...0993-Add-registry-entry-and-builders.patch | 58 +++---- patches/server/1035-DataComponent-API.patch | 4 +- 4 files changed, 148 insertions(+), 162 deletions(-) diff --git a/patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch index 24764d91ee..721db48bdb 100644 --- a/patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0466-Add-RegistryAccess-for-managing-Registries.patch @@ -12,10 +12,10 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java new file mode 100644 -index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91 +index 0000000000000000000000000000000000000000..cd8a6a4c2a63029f8f859765088c227bbd456813 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -@@ -0,0 +1,157 @@ +@@ -0,0 +1,154 @@ +package io.papermc.paper.registry; + +import com.google.common.base.Preconditions; @@ -81,14 +81,11 @@ index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4 +import org.bukkit.inventory.meta.trim.TrimPattern; +import org.bukkit.map.MapCursor; +import org.bukkit.potion.PotionEffectType; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jspecify.annotations.Nullable; + +import static io.papermc.paper.registry.entry.RegistryEntry.apiOnly; +import static io.papermc.paper.registry.entry.RegistryEntry.entry; + -+@DefaultQualifier(NonNull.class) +public final class PaperRegistries { + + static final List> REGISTRY_ENTRIES; @@ -175,10 +172,10 @@ index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4 +} diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java new file mode 100644 -index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bcb1bbf2f3 +index 0000000000000000000000000000000000000000..4bf7915867dbe762ef0b070d67d5f7b7d1ee4f03 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java -@@ -0,0 +1,127 @@ +@@ -0,0 +1,122 @@ +package io.papermc.paper.registry; + +import io.papermc.paper.registry.entry.ApiRegistryEntry; @@ -194,14 +191,9 @@ index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bc +import net.minecraft.resources.ResourceKey; +import org.bukkit.Keyed; +import org.bukkit.Registry; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.checkerframework.framework.qual.DefaultQualifier; +import org.jetbrains.annotations.VisibleForTesting; ++import org.jspecify.annotations.Nullable; + -+import static java.util.Objects.requireNonNull; -+ -+@DefaultQualifier(NonNull.class) +public class PaperRegistryAccess implements RegistryAccess { + + // We store the API registries in a memoized supplier, so they can be created on-demand. @@ -224,14 +216,14 @@ index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bc + @Deprecated(forRemoval = true) + @Override + public @Nullable Registry getRegistry(final Class type) { -+ final @Nullable RegistryKey registryKey = byType(type); ++ final RegistryKey registryKey = byType(type); + // If our mapping from Class -> RegistryKey did not contain the passed type it was either a completely invalid type or a registry + // that merely exists as a SimpleRegistry in the org.bukkit.Registry type. We cannot return a registry for these, return null + // as per method contract in Bukkit#getRegistry. + if (registryKey == null) return null; + -+ final @Nullable RegistryEntry entry = PaperRegistries.getEntry(registryKey); -+ final @Nullable RegistryHolder registry = (RegistryHolder) this.registries.get(registryKey); ++ final RegistryEntry entry = PaperRegistries.getEntry(registryKey); ++ final RegistryHolder registry = (RegistryHolder) this.registries.get(registryKey); + if (registry != null) { + // if the registry exists, return right away. Since this is the "legacy" method, we return DelayedRegistry + // for the non-builtin Registry instances stored as fields in Registry. @@ -352,10 +344,10 @@ index 0000000000000000000000000000000000000000..6d134ace042758da722960cbcb48e525 +} diff --git a/src/main/java/io/papermc/paper/registry/RegistryHolder.java b/src/main/java/io/papermc/paper/registry/RegistryHolder.java new file mode 100644 -index 0000000000000000000000000000000000000000..a31bdd9f02fe75a87fceb2ebe8c36b3232a561cc +index 0000000000000000000000000000000000000000..1b52d4bc868e1e5f84c8416301e193bb9cd315b2 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/RegistryHolder.java -@@ -0,0 +1,47 @@ +@@ -0,0 +1,44 @@ +package io.papermc.paper.registry; + +import com.google.common.base.Suppliers; @@ -364,10 +356,7 @@ index 0000000000000000000000000000000000000000..a31bdd9f02fe75a87fceb2ebe8c36b32 +import java.util.function.Supplier; +import org.bukkit.Keyed; +import org.bukkit.Registry; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; + -+@DefaultQualifier(NonNull.class) +public interface RegistryHolder { + + Registry get(); @@ -471,10 +460,10 @@ index 0000000000000000000000000000000000000000..ceb217dbbb84e8bd51365dd47bf91971 +} diff --git a/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862a1d5ce30 +index 0000000000000000000000000000000000000000..45cbc425da64f0bd3290600869ad425d9e6e912b --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/entry/CraftRegistryEntry.java -@@ -0,0 +1,51 @@ +@@ -0,0 +1,48 @@ +package io.papermc.paper.registry.entry; + +import com.google.common.base.Preconditions; @@ -487,10 +476,7 @@ index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862 +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.CraftRegistry; +import org.bukkit.craftbukkit.util.ApiVersion; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; + -+@DefaultQualifier(NonNull.class) +public class CraftRegistryEntry extends BaseRegistryEntry { // TODO remove Keyed + + private static final BiFunction EMPTY = (namespacedKey, apiVersion) -> namespacedKey; @@ -528,10 +514,10 @@ index 0000000000000000000000000000000000000000..9bb4aa926978f117901c9f99c45a6862 +} diff --git a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..15991bf13894d850f360a520d1815711d25973ec +index 0000000000000000000000000000000000000000..2889d87f0989ae5744cd4c1e57240830aa574155 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java -@@ -0,0 +1,51 @@ +@@ -0,0 +1,48 @@ +package io.papermc.paper.registry.entry; + +import io.papermc.paper.registry.RegistryHolder; @@ -544,10 +530,7 @@ index 0000000000000000000000000000000000000000..15991bf13894d850f360a520d1815711 +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.util.ApiVersion; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; + -+@DefaultQualifier(NonNull.class) +public interface RegistryEntry extends RegistryEntryInfo { // TODO remove Keyed + + RegistryHolder createRegistryHolder(Registry nmsRegistry); @@ -603,34 +586,29 @@ index 0000000000000000000000000000000000000000..0ae855e80fc9fddfc1feb33c7a974820 +} diff --git a/src/main/java/io/papermc/paper/registry/entry/package-info.java b/src/main/java/io/papermc/paper/registry/entry/package-info.java new file mode 100644 -index 0000000000000000000000000000000000000000..e4c94d6860e0f5b643cde1ded20b5503c02a4866 +index 0000000000000000000000000000000000000000..f04e93aa5ca41ce1cf3b152f827911fdf0dd10cb --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/entry/package-info.java -@@ -0,0 +1,5 @@ -+@DefaultQualifier(NonNull.class) +@@ -0,0 +1,4 @@ ++@NullMarked +package io.papermc.paper.registry.entry; + -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java new file mode 100644 -index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a1867adf625b +index 0000000000000000000000000000000000000000..ca829b162d4369f845e59b62bb8779fd83fe2ef3 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java -@@ -0,0 +1,61 @@ +@@ -0,0 +1,57 @@ +package io.papermc.paper.registry.legacy; + +import java.util.Iterator; +import java.util.function.Supplier; +import java.util.stream.Stream; -+import net.kyori.adventure.key.Key; +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; -+import org.bukkit.craftbukkit.CraftRegistry; -+import org.checkerframework.checker.nullness.qual.MonotonicNonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.Nullable; + +/** + * This is to support the now-deprecated fields in {@link Registry} for @@ -638,7 +616,7 @@ index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a186 + */ +public final class DelayedRegistry> implements Registry { + -+ private @MonotonicNonNull Supplier delegate; ++ private @Nullable Supplier delegate; + + public void load(final Supplier registry) { + if (this.delegate != null) { @@ -660,7 +638,7 @@ index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a186 + } + + @Override -+ public @NotNull T getOrThrow(@NotNull final NamespacedKey key) { ++ public T getOrThrow(final NamespacedKey key) { + return this.delegate().getOrThrow(key); + } + @@ -675,7 +653,7 @@ index 0000000000000000000000000000000000000000..9400fed345344a0a8e4fb301cca6a186 + } + + @Override -+ public NamespacedKey getKey(final T value) { ++ public @Nullable NamespacedKey getKey(final T value) { + return this.delegate().getKey(value); + } +} @@ -752,15 +730,24 @@ index 0000000000000000000000000000000000000000..83870816cd4c54f94a3c603ffe41c11e +} diff --git a/src/main/java/io/papermc/paper/registry/legacy/package-info.java b/src/main/java/io/papermc/paper/registry/legacy/package-info.java new file mode 100644 -index 0000000000000000000000000000000000000000..4396982af55872fafbfeaf8161ad6f392726c773 +index 0000000000000000000000000000000000000000..063a8d7a7313d5d685d51df54d9502d72266da49 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/legacy/package-info.java -@@ -0,0 +1,5 @@ -+@DefaultQualifier(NonNull.class) +@@ -0,0 +1,4 @@ ++@NullMarked +package io.papermc.paper.registry.legacy; + -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jspecify.annotations.NullMarked; +diff --git a/src/main/java/io/papermc/paper/registry/package-info.java b/src/main/java/io/papermc/paper/registry/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ca07ef31161e938d48214992b34cafb712a51513 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.registry; ++ ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java index 3f72e30b57fb2a4231e22a2234729408c1240af4..4638ba98dbbdb0f880337347be85a6e0fbed2191 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java diff --git a/patches/server/0992-Registry-Modification-API.patch b/patches/server/0992-Registry-Modification-API.patch index d79be5372f..f498936e5f 100644 --- a/patches/server/0992-Registry-Modification-API.patch +++ b/patches/server/0992-Registry-Modification-API.patch @@ -11,7 +11,7 @@ public net.minecraft.resources.RegistryOps lookupProvider public net.minecraft.resources.RegistryOps$HolderLookupAdapter diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74189dbdad 100644 +index cd8a6a4c2a63029f8f859765088c227bbd456813..86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -3,6 +3,7 @@ package io.papermc.paper.registry; @@ -22,15 +22,15 @@ index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74 import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; -@@ -69,6 +70,7 @@ import org.checkerframework.framework.qual.DefaultQualifier; +@@ -67,6 +68,7 @@ import org.jspecify.annotations.Nullable; import static io.papermc.paper.registry.entry.RegistryEntry.apiOnly; import static io.papermc.paper.registry.entry.RegistryEntry.entry; +import static io.papermc.paper.registry.entry.RegistryEntry.writable; - @DefaultQualifier(NonNull.class) public final class PaperRegistries { -@@ -152,6 +154,15 @@ public final class PaperRegistries { + +@@ -149,6 +151,15 @@ public final class PaperRegistries { return ResourceKey.create((ResourceKey>) PaperRegistries.registryToNms(typedKey.registryKey()), PaperAdventure.asVanilla(typedKey.key())); } @@ -47,10 +47,10 @@ index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74 } } diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java -index 35b6a7c5bac9640332a833bd3627f2bcb1bbf2f3..1026b9c04f94ed73049b980822a2eafdbacea7fd 100644 +index 4bf7915867dbe762ef0b070d67d5f7b7d1ee4f03..ed071ed34e16812f133102b0d66a5201a94639f2 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistryAccess.java -@@ -83,6 +83,14 @@ public class PaperRegistryAccess implements RegistryAccess { +@@ -78,6 +78,14 @@ public class PaperRegistryAccess implements RegistryAccess { return possiblyUnwrap(registryHolder.get()); } @@ -67,15 +67,14 @@ index 35b6a7c5bac9640332a833bd3627f2bcb1bbf2f3..1026b9c04f94ed73049b980822a2eafd return delayedRegistry.delegate(); diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryBuilder.java b/src/main/java/io/papermc/paper/registry/PaperRegistryBuilder.java new file mode 100644 -index 0000000000000000000000000000000000000000..528c6ee1739d92f766f3904acd7fc5734c93388a +index 0000000000000000000000000000000000000000..69e63689083207de2f409557d4a9a17f8ad7ae3e --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistryBuilder.java -@@ -0,0 +1,26 @@ +@@ -0,0 +1,25 @@ +package io.papermc.paper.registry; + +import io.papermc.paper.registry.data.util.Conversions; -+import net.minecraft.resources.RegistryOps; -+import org.checkerframework.checker.nullness.qual.Nullable; ++import org.jspecify.annotations.Nullable; + +public interface PaperRegistryBuilder extends RegistryBuilder { + @@ -99,7 +98,7 @@ index 0000000000000000000000000000000000000000..528c6ee1739d92f766f3904acd7fc573 +} diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistryListenerManager.java b/src/main/java/io/papermc/paper/registry/PaperRegistryListenerManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb3213570b +index 0000000000000000000000000000000000000000..60d9b806a09bb103e36ce1f932a5a34ef408770a --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistryListenerManager.java @@ -0,0 +1,183 @@ @@ -133,8 +132,8 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; -+import org.checkerframework.checker.nullness.qual.Nullable; +import org.intellij.lang.annotations.Subst; ++import org.jspecify.annotations.Nullable; + +public class PaperRegistryListenerManager { + @@ -201,7 +200,7 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb + final Conversions conversions + ) { + Preconditions.checkState(LaunchEntryPointHandler.INSTANCE.hasEntered(Entrypoint.BOOTSTRAPPER), registry.key() + " tried to run modification listeners before bootstrappers have been called"); // verify that bootstrappers have been called -+ final @Nullable RegistryEntryInfo entry = PaperRegistries.getEntry(registry.key()); ++ final RegistryEntryInfo entry = PaperRegistries.getEntry(registry.key()); + if (!RegistryEntry.Modifiable.isModifiable(entry) || !this.valueAddEventTypes.hasHandlers(entry.apiKey())) { + return registerMethod.register((WritableRegistry) registry, key, nms, registrationInfo); + } @@ -262,7 +261,7 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb + } + + public > void runFreezeListeners(final ResourceKey> resourceKey, final Conversions conversions) { -+ final @Nullable RegistryEntryInfo entry = PaperRegistries.getEntry(resourceKey); ++ final RegistryEntryInfo entry = PaperRegistries.getEntry(resourceKey); + if (!RegistryEntry.Addable.isAddable(entry) || !this.freezeEventTypes.hasHandlers(entry.apiKey())) { + return; + } @@ -320,7 +319,7 @@ index 6d134ace042758da722960cbcb48e52508dafd61..cc39bc68d29055ef6429f08f975412bd } diff --git a/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java b/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java new file mode 100644 -index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696700764c8 +index 0000000000000000000000000000000000000000..ef91352d442d9ddd666af6bde9a186ce15e5aa04 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java @@ -0,0 +1,92 @@ @@ -341,7 +340,7 @@ index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696 +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.CraftRegistry; +import org.bukkit.craftbukkit.util.ApiVersion; -+import org.checkerframework.checker.nullness.qual.Nullable; ++import org.jspecify.annotations.Nullable; + +public class WritableCraftRegistry> extends CraftRegistry { + @@ -418,22 +417,19 @@ index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696 +} diff --git a/src/main/java/io/papermc/paper/registry/data/util/Conversions.java b/src/main/java/io/papermc/paper/registry/data/util/Conversions.java new file mode 100644 -index 0000000000000000000000000000000000000000..eda5cc7d45ef59ccc1c9c7e027c1f044f1dcc86b +index 0000000000000000000000000000000000000000..1e9a0143bc3b70dfc5e129a0fe849ff3e01447ab --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/util/Conversions.java -@@ -0,0 +1,36 @@ +@@ -0,0 +1,33 @@ +package io.papermc.paper.registry.data.util; + +import com.mojang.serialization.JavaOps; +import io.papermc.paper.adventure.WrapperAwareSerializer; +import net.kyori.adventure.text.Component; +import net.minecraft.resources.RegistryOps; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.checkerframework.framework.qual.DefaultQualifier; +import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.Nullable; + -+@DefaultQualifier(NonNull.class) +public class Conversions { + + private final RegistryOps.RegistryInfoLookup lookup; @@ -458,6 +454,16 @@ index 0000000000000000000000000000000000000000..eda5cc7d45ef59ccc1c9c7e027c1f044 + return vanilla == null ? Component.empty() : this.serializer.deserialize(vanilla); + } +} +diff --git a/src/main/java/io/papermc/paper/registry/data/util/package-info.java b/src/main/java/io/papermc/paper/registry/data/util/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5b88be976c7773459ce1b6daf58d7ea7c806f21b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/data/util/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.registry.data.util; ++ ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/io/papermc/paper/registry/entry/AddableRegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/AddableRegistryEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..aeec9b3ae2911f041d000b3db72f37974020ba60 @@ -547,7 +553,7 @@ index 0000000000000000000000000000000000000000..515a995e3862f8e7cb93d149315ea32e + } +} diff --git a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java -index 15991bf13894d850f360a520d1815711d25973ec..f2e919705301cb23ed1938ca3c1976378249172c 100644 +index 2889d87f0989ae5744cd4c1e57240830aa574155..9494bcf82101340e04559d850570698947b7a9ff 100644 --- a/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java +++ b/src/main/java/io/papermc/paper/registry/entry/RegistryEntry.java @@ -1,7 +1,13 @@ @@ -564,15 +570,15 @@ index 15991bf13894d850f360a520d1815711d25973ec..f2e919705301cb23ed1938ca3c197637 import io.papermc.paper.registry.legacy.DelayedRegistryEntry; import java.util.function.BiFunction; import java.util.function.Supplier; -@@ -11,6 +17,7 @@ import org.bukkit.Keyed; +@@ -10,6 +16,7 @@ import net.minecraft.resources.ResourceKey; + import org.bukkit.Keyed; import org.bukkit.NamespacedKey; import org.bukkit.craftbukkit.util.ApiVersion; - import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; - import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jspecify.annotations.Nullable; - @DefaultQualifier(NonNull.class) -@@ -32,6 +39,65 @@ public interface RegistryEntry extends RegistryEntryInfo extends RegistryEntryInfo { // TODO remove Keyed + +@@ -29,6 +36,65 @@ public interface RegistryEntry extends RegistryEntryInfo(this); } @@ -638,7 +644,7 @@ index 15991bf13894d850f360a520d1815711d25973ec..f2e919705301cb23ed1938ca3c197637 static RegistryEntry entry( final ResourceKey> mcKey, final RegistryKey apiKey, -@@ -48,4 +114,24 @@ public interface RegistryEntry extends RegistryEntryInfo extends RegistryEntryInfo(mcKey, apiKey, apiRegistrySupplier); } @@ -693,10 +699,10 @@ index 0000000000000000000000000000000000000000..562accce731630327d116afd1c9d559d +} diff --git a/src/main/java/io/papermc/paper/registry/event/RegistryEntryAddEventImpl.java b/src/main/java/io/papermc/paper/registry/event/RegistryEntryAddEventImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..cc9c8fd313f530777af80ad79e03903f3f8f9829 +index 0000000000000000000000000000000000000000..332829c65ef45966dffcf5f1c59422a801179759 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/event/RegistryEntryAddEventImpl.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,29 @@ +package io.papermc.paper.registry.event; + +import io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEvent; @@ -711,7 +717,6 @@ index 0000000000000000000000000000000000000000..cc9c8fd313f530777af80ad79e03903f +import net.minecraft.core.HolderSet; +import net.minecraft.resources.RegistryOps; +import org.bukkit.Keyed; -+import org.checkerframework.checker.nullness.qual.NonNull; + +public record RegistryEntryAddEventImpl>( + TypedKey key, @@ -721,7 +726,7 @@ index 0000000000000000000000000000000000000000..cc9c8fd313f530777af80ad79e03903f +) implements RegistryEntryAddEvent, PaperLifecycleEvent { + + @Override -+ public @NonNull Tag getOrCreateTag(final TagKey tagKey) { ++ public Tag getOrCreateTag(final TagKey tagKey) { + final RegistryOps.RegistryInfo registryInfo = this.conversions.lookup().lookup(PaperRegistries.registryToNms(tagKey.registryKey())).orElseThrow(); + final HolderSet.Named tagSet = registryInfo.getter().getOrThrow(PaperRegistries.toNms(tagKey)); + return new NamedRegistryKeySetImpl<>(tagKey, tagSet); @@ -810,10 +815,10 @@ index 0000000000000000000000000000000000000000..34c842ffa355e3c8001dd7b8551bcb49 +} diff --git a/src/main/java/io/papermc/paper/registry/event/RegistryFreezeEventImpl.java b/src/main/java/io/papermc/paper/registry/event/RegistryFreezeEventImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfad7b71b81 +index 0000000000000000000000000000000000000000..1b45802f9afc97fd59c6dc77964dedea1016cd6c --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/event/RegistryFreezeEventImpl.java -@@ -0,0 +1,28 @@ +@@ -0,0 +1,27 @@ +package io.papermc.paper.registry.event; + +import io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEvent; @@ -827,7 +832,6 @@ index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfa +import net.minecraft.core.HolderSet; +import net.minecraft.resources.RegistryOps; +import org.bukkit.Keyed; -+import org.checkerframework.checker.nullness.qual.NonNull; + +public record RegistryFreezeEventImpl>( + RegistryKey registryKey, @@ -836,7 +840,7 @@ index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfa +) implements RegistryFreezeEvent, PaperLifecycleEvent { + + @Override -+ public @NonNull Tag getOrCreateTag(final TagKey tagKey) { ++ public Tag getOrCreateTag(final TagKey tagKey) { + final RegistryOps.RegistryInfo registryInfo = this.conversions.lookup().lookup(PaperRegistries.registryToNms(tagKey.registryKey())).orElseThrow(); + final HolderSet.Named tagSet = registryInfo.getter().getOrThrow(PaperRegistries.toNms(tagKey)); + return new NamedRegistryKeySetImpl<>(tagKey, tagSet); @@ -844,15 +848,14 @@ index 0000000000000000000000000000000000000000..63957d2509e68ccc6eb2fd9ecaa35bfa +} diff --git a/src/main/java/io/papermc/paper/registry/event/package-info.java b/src/main/java/io/papermc/paper/registry/event/package-info.java new file mode 100644 -index 0000000000000000000000000000000000000000..14d2d9766b8dee763f220c397aba3ad432d02aaa +index 0000000000000000000000000000000000000000..1d20e0d940ae498b96fe33f6176c140f816921f1 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/event/package-info.java -@@ -0,0 +1,5 @@ -+@DefaultQualifier(NonNull.class) +@@ -0,0 +1,4 @@ ++@NullMarked +package io.papermc.paper.registry.event; + -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddEventTypeImpl.java b/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddEventTypeImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fbf853bf1cbb3c7bbef531afe185818b9454299b @@ -898,7 +901,7 @@ index 0000000000000000000000000000000000000000..fbf853bf1cbb3c7bbef531afe185818b +} diff --git a/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddHandlerConfiguration.java b/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddHandlerConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..548f5bf979e88708e98d04dfe22ccaa300c91ddd +index 0000000000000000000000000000000000000000..3cc0f7688f61c5fdbd98d0134741c98a8b9748b9 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/event/type/RegistryEntryAddHandlerConfiguration.java @@ -0,0 +1,42 @@ @@ -912,8 +915,8 @@ index 0000000000000000000000000000000000000000..548f5bf979e88708e98d04dfe22ccaa3 +import io.papermc.paper.registry.TypedKey; +import io.papermc.paper.registry.event.RegistryEntryAddEvent; +import java.util.function.Predicate; -+import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.Nullable; + +public class RegistryEntryAddHandlerConfiguration> extends PrioritizedLifecycleEventHandlerConfigurationImpl> implements RegistryEntryAddConfiguration { + @@ -968,8 +971,18 @@ index 0000000000000000000000000000000000000000..7ee77022198bf5f9f88c6a1917a1da30 + return false; // only runs once + } +} +diff --git a/src/main/java/io/papermc/paper/registry/event/type/package-info.java b/src/main/java/io/papermc/paper/registry/event/type/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f9f63926a5aaf84e0d23bac3422c5800683e37f9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/event/type/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.registry.event.type; ++ ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java -index 9400fed345344a0a8e4fb301cca6a1867adf625b..0cdc92acd3ebb6efb10e1b66419cc05618301581 100644 +index ca829b162d4369f845e59b62bb8779fd83fe2ef3..2de5aa3f0f17b29a6cf9d81ebda81aed7295c1f1 100644 --- a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java +++ b/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java @@ -1,5 +1,7 @@ @@ -980,16 +993,8 @@ index 9400fed345344a0a8e4fb301cca6a1867adf625b..0cdc92acd3ebb6efb10e1b66419cc056 import java.util.Iterator; import java.util.function.Supplier; import java.util.stream.Stream; -@@ -7,7 +9,6 @@ import net.kyori.adventure.key.Key; - import org.bukkit.Keyed; - import org.bukkit.NamespacedKey; - import org.bukkit.Registry; --import org.bukkit.craftbukkit.CraftRegistry; - import org.checkerframework.checker.nullness.qual.MonotonicNonNull; - import org.checkerframework.checker.nullness.qual.Nullable; - import org.jetbrains.annotations.NotNull; -@@ -58,4 +59,14 @@ public final class DelayedRegistry> imple - public NamespacedKey getKey(final T value) { +@@ -54,4 +56,14 @@ public final class DelayedRegistry> imple + public @Nullable NamespacedKey getKey(final T value) { return this.delegate().getKey(value); } + @@ -1003,23 +1008,12 @@ index 9400fed345344a0a8e4fb301cca6a1867adf625b..0cdc92acd3ebb6efb10e1b66419cc056 + return this.delegate().getTag(key); + } } -diff --git a/src/main/java/io/papermc/paper/registry/package-info.java b/src/main/java/io/papermc/paper/registry/package-info.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0b80179ff90e085568d7ceafd9b17511789dc99b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/package-info.java -@@ -0,0 +1,5 @@ -+@DefaultQualifier(NonNull.class) -+package io.papermc.paper.registry; -+ -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/io/papermc/paper/registry/set/NamedRegistryKeySetImpl.java b/src/main/java/io/papermc/paper/registry/set/NamedRegistryKeySetImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..e8c2c18a1ed5cd587266bd415170610781531a12 +index 0000000000000000000000000000000000000000..7b15640c2f10c72f2612ab2270adc5689dfd9e5a --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/set/NamedRegistryKeySetImpl.java -@@ -0,0 +1,76 @@ +@@ -0,0 +1,74 @@ +package io.papermc.paper.registry.set; + +import com.google.common.collect.ImmutableList; @@ -1039,12 +1033,10 @@ index 0000000000000000000000000000000000000000..e8c2c18a1ed5cd587266bd4151706107 +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; -+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Unmodifiable; ++import org.jspecify.annotations.NullMarked; + -+@DefaultQualifier(NonNull.class) ++@NullMarked +public record NamedRegistryKeySetImpl( // TODO remove Keyed + TagKey tagKey, + HolderSet.Named namedSet @@ -1091,17 +1083,17 @@ index 0000000000000000000000000000000000000000..e8c2c18a1ed5cd587266bd4151706107 + } + + @Override -+ public @NotNull NamespacedKey getKey() { ++ public NamespacedKey getKey() { + final Key key = this.tagKey().key(); + return new NamespacedKey(key.namespace(), key.value()); + } +} diff --git a/src/main/java/io/papermc/paper/registry/set/PaperRegistrySets.java b/src/main/java/io/papermc/paper/registry/set/PaperRegistrySets.java new file mode 100644 -index 0000000000000000000000000000000000000000..f09ce9c8547ef05153847245746473dd9a8acbe6 +index 0000000000000000000000000000000000000000..cb92f53cf9d139828acd016499470212a198b722 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/set/PaperRegistrySets.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,45 @@ +package io.papermc.paper.registry.set; + +import io.papermc.paper.registry.PaperRegistries; @@ -1115,10 +1107,7 @@ index 0000000000000000000000000000000000000000..f09ce9c8547ef05153847245746473dd +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceKey; +import org.bukkit.Keyed; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; + -+@DefaultQualifier(NonNull.class) +public final class PaperRegistrySets { + + public static HolderSet convertToNms(final ResourceKey> resourceKey, final RegistryOps.RegistryInfoLookup lookup, final RegistryKeySet registryKeySet) { // TODO remove Keyed @@ -1150,6 +1139,16 @@ index 0000000000000000000000000000000000000000..f09ce9c8547ef05153847245746473dd + private PaperRegistrySets() { + } +} +diff --git a/src/main/java/io/papermc/paper/registry/set/package-info.java b/src/main/java/io/papermc/paper/registry/set/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..516b072428dcc8a28d13bcc990493cf4c22ad948 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/set/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.registry.set; ++ ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java index 71e04e5c1bc0722abf8ca2e0738bd60b6d7ae21c..063630c1ffcce099139c59d598fc5a210e21f640 100644 --- a/src/main/java/net/minecraft/core/MappedRegistry.java diff --git a/patches/server/0993-Add-registry-entry-and-builders.patch b/patches/server/0993-Add-registry-entry-and-builders.patch index 6320aa8569..36bfa68a40 100644 --- a/patches/server/0993-Add-registry-entry-and-builders.patch +++ b/patches/server/0993-Add-registry-entry-and-builders.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add registry entry and builders Feature patch diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b8e024e34 100644 +index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af18159b7c4 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -2,6 +2,9 @@ package io.papermc.paper.registry; @@ -19,7 +19,7 @@ index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b import io.papermc.paper.registry.entry.RegistryEntry; import io.papermc.paper.registry.tag.TagKey; import java.util.Collections; -@@ -81,7 +84,7 @@ public final class PaperRegistries { +@@ -78,7 +81,7 @@ public final class PaperRegistries { static { REGISTRY_ENTRIES = List.of( // built-ins @@ -28,7 +28,7 @@ index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new), entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new), entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new), -@@ -103,10 +106,10 @@ public final class PaperRegistries { +@@ -100,10 +103,10 @@ public final class PaperRegistries { entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(), entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(), entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(), @@ -43,10 +43,10 @@ index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..31d660bbbe62cd2c26715e8d90fef58b // api-only diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3086ea9bf +index 0000000000000000000000000000000000000000..1b1c6838452d3001070a5d43cc49e3a09de7153d --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java -@@ -0,0 +1,234 @@ +@@ -0,0 +1,230 @@ +package io.papermc.paper.registry.data; + +import com.google.common.base.Preconditions; @@ -72,31 +72,27 @@ index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3 +import net.minecraft.world.item.enchantment.Enchantment; +import org.bukkit.craftbukkit.CraftEquipmentSlot; +import org.bukkit.inventory.ItemType; -+import org.checkerframework.checker.nullness.qual.MonotonicNonNull; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.checkerframework.framework.qual.DefaultQualifier; +import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.Nullable; + +import static io.papermc.paper.registry.data.util.Checks.asArgument; +import static io.papermc.paper.registry.data.util.Checks.asArgumentMin; +import static io.papermc.paper.registry.data.util.Checks.asConfigured; + -+@DefaultQualifier(NonNull.class) +public class PaperEnchantmentRegistryEntry implements EnchantmentRegistryEntry { + + // Top level -+ protected @MonotonicNonNull Component description; ++ protected @Nullable Component description; + + // Definition -+ protected @MonotonicNonNull HolderSet supportedItems; ++ protected @Nullable HolderSet supportedItems; + protected @Nullable HolderSet primaryItems; + protected OptionalInt weight = OptionalInt.empty(); + protected OptionalInt maxLevel = OptionalInt.empty(); -+ protected Enchantment.@MonotonicNonNull Cost minimumCost; -+ protected Enchantment.@MonotonicNonNull Cost maximumCost; ++ protected Enchantment.@Nullable Cost minimumCost; ++ protected Enchantment.@Nullable Cost maximumCost; + protected OptionalInt anvilCost = OptionalInt.empty(); -+ protected @MonotonicNonNull List activeSlots; ++ protected @Nullable List activeSlots; + + // Exclusive + protected HolderSet exclusiveWith = HolderSet.empty(); // Paper added default to empty. @@ -165,13 +161,13 @@ index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3 + + @Override + public EnchantmentCost minimumCost() { -+ final Enchantment.@MonotonicNonNull Cost cost = asConfigured(this.minimumCost, "minimumCost"); ++ final Enchantment.Cost cost = asConfigured(this.minimumCost, "minimumCost"); + return EnchantmentRegistryEntry.EnchantmentCost.of(cost.base(), cost.perLevelAboveFirst()); + } + + @Override + public EnchantmentCost maximumCost() { -+ final Enchantment.@MonotonicNonNull Cost cost = asConfigured(this.maximumCost, "maximumCost"); ++ final Enchantment.Cost cost = asConfigured(this.maximumCost, "maximumCost"); + return EnchantmentRegistryEntry.EnchantmentCost.of(cost.base(), cost.perLevelAboveFirst()); + } + @@ -283,25 +279,22 @@ index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3 +} diff --git a/src/main/java/io/papermc/paper/registry/data/PaperGameEventRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperGameEventRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..a96609223ed1e0500f8a4b868e309c0fc82bbc31 +index 0000000000000000000000000000000000000000..2100e8aca6f7ae7b90545bd3f4d4b800dba65daa --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/PaperGameEventRegistryEntry.java -@@ -0,0 +1,57 @@ +@@ -0,0 +1,54 @@ +package io.papermc.paper.registry.data; + +import io.papermc.paper.registry.PaperRegistryBuilder; +import io.papermc.paper.registry.data.util.Conversions; +import java.util.OptionalInt; +import net.minecraft.world.level.gameevent.GameEvent; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.checkerframework.framework.qual.DefaultQualifier; +import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.Nullable; + +import static io.papermc.paper.registry.data.util.Checks.asArgumentMin; +import static io.papermc.paper.registry.data.util.Checks.asConfigured; + -+@DefaultQualifier(NonNull.class) +public class PaperGameEventRegistryEntry implements GameEventRegistryEntry { + + protected OptionalInt range = OptionalInt.empty(); @@ -470,20 +463,27 @@ index 0000000000000000000000000000000000000000..68b3d747f759f615a3c942de3f4d7a0f + } + } +} +diff --git a/src/main/java/io/papermc/paper/registry/data/package-info.java b/src/main/java/io/papermc/paper/registry/data/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cfcf814eb527e6b82a2319f28df43b085ca5c168 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/data/package-info.java +@@ -0,0 +1,4 @@ ++@NullMarked ++package io.papermc.paper.registry.data; ++ ++import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/io/papermc/paper/registry/data/util/Checks.java b/src/main/java/io/papermc/paper/registry/data/util/Checks.java new file mode 100644 -index 0000000000000000000000000000000000000000..3241a94731fe8163876614efdcf30f8b551535af +index 0000000000000000000000000000000000000000..9d61fad3989540b77734e57935104696e3c2b5b8 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/util/Checks.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,45 @@ +package io.papermc.paper.registry.data.util; + +import java.util.OptionalInt; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.checker.nullness.qual.Nullable; -+import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jspecify.annotations.Nullable; + -+@DefaultQualifier(NonNull.class) +public final class Checks { + + public static T asConfigured(final @Nullable T value, final String field) { diff --git a/patches/server/1035-DataComponent-API.patch b/patches/server/1035-DataComponent-API.patch index 91ad0459a6..b2cf36195b 100644 --- a/patches/server/1035-DataComponent-API.patch +++ b/patches/server/1035-DataComponent-API.patch @@ -3589,7 +3589,7 @@ index 0000000000000000000000000000000000000000..62aa1061c35d5358e6dec16a52574b42 + +import org.jspecify.annotations.NullMarked; diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 31d660bbbe62cd2c26715e8d90fef58b8e024e34..7e5d1d4f563dfd4beef9cd73b3670714c96bacaf 100644 +index fd024576e70e0c121c1477a0b7777af18159b7c4..b81d0d906789ef2ff3759395821316462aacf323 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -2,6 +2,8 @@ package io.papermc.paper.registry; @@ -3601,7 +3601,7 @@ index 31d660bbbe62cd2c26715e8d90fef58b8e024e34..7e5d1d4f563dfd4beef9cd73b3670714 import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry; import io.papermc.paper.registry.data.PaperGameEventRegistryEntry; import io.papermc.paper.registry.data.PaperPaintingVariantRegistryEntry; -@@ -98,6 +100,7 @@ public final class PaperRegistries { +@@ -95,6 +97,7 @@ public final class PaperRegistries { entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new), entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new), entry(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, Sound.class, CraftSound::new),