Fix more incorrect array nullability annotations (#11836)

This commit is contained in:
Jake Potrebic
2024-12-27 13:24:16 -08:00
committed by GitHub
parent 13c94e40ad
commit ca8709b30f
27 changed files with 61 additions and 77 deletions

View File

@@ -329,7 +329,7 @@ public interface EntityEquipment {
*
* @param items The items to set the armor as. Individual items may be null.
*/
void setArmorContents(@NotNull ItemStack[] items);
void setArmorContents(@NotNull ItemStack @NotNull [] items);
/**
* Clears the entity of all armor and held items

View File

@@ -24,8 +24,7 @@ public interface ItemCraftResult {
*
* @return resulting matrix
*/
@NotNull
public ItemStack[] getResultingMatrix();
public @NotNull ItemStack @NotNull [] getResultingMatrix();
/**
* Gets the overflowed items for items that don't fit back into the crafting

View File

@@ -744,8 +744,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* @param bytes bytes representing an item in NBT
* @return ItemStack migrated to this version of Minecraft if needed.
*/
@NotNull
public static ItemStack deserializeBytes(@NotNull byte[] bytes) {
public static @NotNull ItemStack deserializeBytes(final byte @NotNull [] bytes) {
return org.bukkit.Bukkit.getUnsafe().deserializeItem(bytes);
}
@@ -754,8 +753,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
* use the built in data converter instead of bukkits dangerous serialization system.
* @return bytes representing this item in NBT.
*/
@NotNull
public byte[] serializeAsBytes() {
public byte @NotNull [] serializeAsBytes() {
return org.bukkit.Bukkit.getUnsafe().serializeItem(this);
}

View File

@@ -118,7 +118,7 @@ public interface PlayerInventory extends Inventory {
*
* @param items The ItemStacks to use as armour
*/
public void setArmorContents(@Nullable ItemStack[] items);
public void setArmorContents(@Nullable ItemStack @NotNull [] items);
/**
* Put the given ItemStacks into the extra slots
@@ -127,7 +127,7 @@ public interface PlayerInventory extends Inventory {
*
* @param items The ItemStacks to use as extra
*/
public void setExtraContents(@Nullable ItemStack[] items);
public void setExtraContents(@Nullable ItemStack @NotNull [] items);
/**
* Put the given ItemStack into the helmet slot. This does not check if

View File

@@ -234,8 +234,7 @@ public class ShapedRecipe extends CraftingRecipe {
* @return The recipe's shape.
* @throws NullPointerException when not set yet
*/
@NotNull
public String[] getShape() {
public @NotNull String @NotNull [] getShape() {
return rows.clone();
}
}

View File

@@ -4,6 +4,7 @@ import org.bukkit.enchantments.EnchantmentOffer;
import org.bukkit.inventory.EnchantingInventory;
import org.bukkit.inventory.InventoryView;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable;
/**
* An instance of {@link InventoryView} which provides extra methods related to
@@ -36,8 +37,7 @@ public interface EnchantmentView extends InventoryView {
*
* @return The enchantment offers that are provided
*/
@NotNull
EnchantmentOffer[] getOffers();
@Nullable EnchantmentOffer @NotNull [] getOffers();
/**
* Sets the offers to provide to the player.
@@ -45,5 +45,5 @@ public interface EnchantmentView extends InventoryView {
* @param offers The offers to provide
* @throws IllegalArgumentException if the array length isn't 3
*/
void setOffers(@NotNull EnchantmentOffer[] offers) throws IllegalArgumentException;
void setOffers(@Nullable EnchantmentOffer @NotNull [] offers) throws IllegalArgumentException;
}