SPIGOT-2540: Add nullability annotations to entire Bukkit API

By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
Bukkit/Spigot
2019-03-13 17:42:57 +11:00
parent e069a80fd8
commit 416c865476
565 changed files with 5372 additions and 2008 deletions

View File

@@ -1,6 +1,7 @@
package org.bukkit.metadata;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -17,7 +18,7 @@ public interface Metadatable {
* @throws IllegalArgumentException If value is null, or the owning plugin
* is null
*/
public void setMetadata(String metadataKey, MetadataValue newMetadataValue);
public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue);
/**
* Returns a list of previously set metadata values from the implementing
@@ -27,7 +28,8 @@ public interface Metadatable {
* @return A list of values, one for each plugin that has set the
* requested value.
*/
public List<MetadataValue> getMetadata(String metadataKey);
@NotNull
public List<MetadataValue> getMetadata(@NotNull String metadataKey);
/**
* Tests to see whether the implementing object contains the given
@@ -36,7 +38,7 @@ public interface Metadatable {
* @param metadataKey the unique metadata key being queried.
* @return the existence of the metadataKey within subject.
*/
public boolean hasMetadata(String metadataKey);
public boolean hasMetadata(@NotNull String metadataKey);
/**
* Removes the given metadata value from the implementing object's
@@ -48,5 +50,5 @@ public interface Metadatable {
* other values will be left untouched.
* @throws IllegalArgumentException If plugin is null
*/
public void removeMetadata(String metadataKey, Plugin owningPlugin);
public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin);
}