3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00
Paper/Spigot-API-Patches/0282-fix-Inventory-getContents-null-annotations.patch
Jason 6caa330c61
Add checkerframework nullness annotations to accepted list for AnnotationTest (#5409)
Also use checkerframework annotations instead of jetbrains ones for Inventory#getContents as jetbrains ones do not allow properly annotating the nullability of an array and it's contents.
2021-03-24 03:02:32 -07:00

23 Zeilen
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: CDFN <codefun@protonmail.com>
Date: Fri, 12 Mar 2021 18:31:31 +0100
Subject: [PATCH] fix Inventory#getContents null annotations
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 6386206188e820206bb1a9f516b5e194fdc9d952..7956aebcb390379677dccf7c9561866cf94c024c 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -158,9 +158,8 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return An array of ItemStacks from the inventory. Individual items may be null.
*/
- @NotNull
- public ItemStack[] getContents();
-
+ public @org.checkerframework.checker.nullness.qual.Nullable ItemStack @org.checkerframework.checker.nullness.qual.NonNull [] getContents(); // Paper - make array elements nullable instead array
+
/**
* Completely replaces the inventory's contents. Removes all existing
* contents and replaces it with the ItemStacks given in the array.