From b52fea44fe45c20c45d7d249087f113feeacf40a 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 | 59 ++++------ .../Add-registry-entry-and-builders.patch | 40 +++---- .../server/Registry-Modification-API.patch | 105 +++++++++--------- 3 files changed, 95 insertions(+), 109 deletions(-) diff --git a/patches/server/Add-RegistryAccess-for-managing-Registries.patch b/patches/server/Add-RegistryAccess-for-managing-Registries.patch index 8ca600b34d..f2f0aa4d1f 100644 --- a/patches/server/Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/Add-RegistryAccess-for-managing-Registries.patch @@ -81,14 +81,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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; @@ -194,14 +191,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + @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. @@ -364,10 +356,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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(); @@ -487,10 +476,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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; @@ -544,10 +530,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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); @@ -607,11 +590,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/entry/package-info.java @@ -0,0 +0,0 @@ -+@DefaultQualifier(NonNull.class) ++@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..0000000000000000000000000000000000000000 @@ -623,14 +605,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + */ +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..00000000000000000000000000000000 + } + + @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..00000000000000000000000000000000 + } + + @Override -+ public NamespacedKey getKey(final T value) { ++ public @Nullable NamespacedKey getKey(final T value) { + return this.delegate().getKey(value); + } +} @@ -756,11 +734,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/legacy/package-info.java @@ -0,0 +0,0 @@ -+@DefaultQualifier(NonNull.class) ++@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..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/package-info.java +@@ -0,0 +0,0 @@ ++@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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java diff --git a/patches/server/Add-registry-entry-and-builders.patch b/patches/server/Add-registry-entry-and-builders.patch index 5bb7305f7b..f3f3fdc2b0 100644 --- a/patches/server/Add-registry-entry-and-builders.patch +++ b/patches/server/Add-registry-entry-and-builders.patch @@ -72,31 +72,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + + @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()); + } + @@ -293,15 +289,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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,6 +463,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} +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..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/data/package-info.java +@@ -0,0 +0,0 @@ ++@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..0000000000000000000000000000000000000000 @@ -479,11 +482,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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/Registry-Modification-API.patch b/patches/server/Registry-Modification-API.patch index 38287678fe..1009539d08 100644 --- a/patches/server/Registry-Modification-API.patch +++ b/patches/server/Registry-Modification-API.patch @@ -22,14 +22,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; -@@ -0,0 +0,0 @@ import org.checkerframework.framework.qual.DefaultQualifier; +@@ -0,0 +0,0 @@ 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 { + @@ -0,0 +0,0 @@ public final class PaperRegistries { return ResourceKey.create((ResourceKey>) PaperRegistries.registryToNms(typedKey.registryKey()), PaperAdventure.asVanilla(typedKey.key())); } @@ -74,8 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 { + @@ -133,8 +132,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + } + + 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; + } @@ -341,7 +340,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 { + @@ -428,12 +427,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/data/util/package-info.java +@@ -0,0 +0,0 @@ ++@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..0000000000000000000000000000000000000000 @@ -564,14 +570,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import io.papermc.paper.registry.legacy.DelayedRegistryEntry; import java.util.function.BiFunction; import java.util.function.Supplier; -@@ -0,0 +0,0 @@ import org.bukkit.Keyed; +@@ -0,0 +0,0 @@ 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; + + public interface RegistryEntry extends RegistryEntryInfo { // TODO remove Keyed - @DefaultQualifier(NonNull.class) @@ -0,0 +0,0 @@ public interface RegistryEntry extends RegistryEntryInfo(this); } @@ -711,7 +717,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 +) 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); @@ -827,7 +832,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 +) 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); @@ -848,11 +852,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/event/package-info.java @@ -0,0 +0,0 @@ -+@DefaultQualifier(NonNull.class) ++@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..0000000000000000000000000000000000000000 @@ -912,8 +915,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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,6 +971,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/event/type/package-info.java +@@ -0,0 +0,0 @@ ++@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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/io/papermc/paper/registry/legacy/DelayedRegistry.java @@ -980,16 +993,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Iterator; import java.util.function.Supplier; import java.util.stream.Stream; -@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public final class DelayedRegistry> imple - public NamespacedKey getKey(final T value) { + public @Nullable NamespacedKey getKey(final T value) { return this.delegate().getKey(value); } + @@ -1003,17 +1008,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/package-info.java -@@ -0,0 +0,0 @@ -+@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..0000000000000000000000000000000000000000 @@ -1039,12 +1033,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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,7 +1083,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public @NotNull NamespacedKey getKey() { ++ public NamespacedKey getKey() { + final Key key = this.tagKey().key(); + return new NamespacedKey(key.namespace(), key.value()); + } @@ -1115,10 +1107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/set/package-info.java +@@ -0,0 +0,0 @@ ++@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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/core/MappedRegistry.java