Finish converting most of the undeprecated api to jspecify

This commit is contained in:
Jake Potrebic
2024-09-30 11:44:36 -07:00
parent 29a25df60e
commit 0adf5876db
45 changed files with 782 additions and 718 deletions

View File

@@ -12,22 +12,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package io.papermc.paper.potion;
+
+import java.util.Objects;
+import java.util.function.Predicate;
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.RecipeChoice;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Objects;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Represents a potion mix made in a Brewing Stand.
+ */
+@ApiStatus.NonExtendable
+public class PotionMix implements Keyed {
+@NullMarked
+public final class PotionMix implements Keyed {
+
+ private final NamespacedKey key;
+ private final ItemStack result;
@@ -42,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param input the input placed into the bottom 3 slots
+ * @param ingredient the ingredient placed into the top slot
+ */
+ public PotionMix(final @NotNull NamespacedKey key, final @NotNull ItemStack result, final @NotNull RecipeChoice input, final @NotNull RecipeChoice ingredient) {
+ public PotionMix(final NamespacedKey key, final ItemStack result, final RecipeChoice input, final RecipeChoice ingredient) {
+ this.key = key;
+ this.result = result;
+ this.input = input;
@@ -57,12 +55,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return a new RecipeChoice
+ */
+ @Contract(value = "_ -> new", pure = true)
+ public static @NotNull RecipeChoice createPredicateChoice(final @NotNull Predicate<? super ItemStack> stackPredicate) {
+ public static RecipeChoice createPredicateChoice(final Predicate<? super ItemStack> stackPredicate) {
+ return new PredicateRecipeChoice(stackPredicate);
+ }
+
+ @Override
+ public @NotNull NamespacedKey getKey() {
+ public NamespacedKey getKey() {
+ return this.key;
+ }
+
@@ -71,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the result itemstack
+ */
+ public @NotNull ItemStack getResult() {
+ public ItemStack getResult() {
+ return this.result;
+ }
+
@@ -80,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the bottom 3 slot ingredients
+ */
+ public @NotNull RecipeChoice getInput() {
+ public RecipeChoice getInput() {
+ return this.input;
+ }
+
@@ -89,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the top slot input
+ */
+ public @NotNull RecipeChoice getIngredient() {
+ public RecipeChoice getIngredient() {
+ return this.ingredient;
+ }
+
@@ -126,12 +124,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.function.Predicate;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.RecipeChoice;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
+
+@ApiStatus.Internal
+@DefaultQualifier(NonNull.class)
+@NullMarked
+record PredicateRecipeChoice(Predicate<? super ItemStack> itemStackPredicate) implements RecipeChoice, Cloneable {
+
+ @Override