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
@@ -2,6 +2,8 @@ package org.bukkit.command;
import java.util.List;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface CommandMap {
@@ -20,7 +22,7 @@ public interface CommandMap {
* a ':' one or more times to make the command unique
* @param commands a list of commands to register
*/
public void registerAll(String fallbackPrefix, List<Command> commands);
public void registerAll(@NotNull String fallbackPrefix, @NotNull List<Command> commands);
/**
* Registers a command. Returns true on success; false if name is already
@@ -42,7 +44,7 @@ public interface CommandMap {
* otherwise, which indicates the fallbackPrefix was used one or more
* times
*/
public boolean register(String label, String fallbackPrefix, Command command);
public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command);
/**
* Registers a command. Returns true on success; false if name is already
@@ -64,7 +66,7 @@ public interface CommandMap {
* otherwise, which indicates the fallbackPrefix was used one or more
* times
*/
public boolean register(String fallbackPrefix, Command command);
public boolean register(@NotNull String fallbackPrefix, @NotNull Command command);
/**
* Looks for the requested command and executes it if found.
@@ -75,7 +77,7 @@ public interface CommandMap {
* @throws CommandException Thrown when the executor for the given command
* fails with an unhandled exception
*/
public boolean dispatch(CommandSender sender, String cmdLine) throws CommandException;
public boolean dispatch(@NotNull CommandSender sender, @NotNull String cmdLine) throws CommandException;
/**
* Clears all registered commands.
@@ -89,7 +91,8 @@ public interface CommandMap {
* @return Command with the specified name or null if a command with that
* label doesn't exist
*/
public Command getCommand(String name);
@Nullable
public Command getCommand(@NotNull String name);
/**
* Looks for the requested command and executes an appropriate
@@ -105,7 +108,8 @@ public interface CommandMap {
* command fails with an unhandled exception
* @throws IllegalArgumentException if either sender or cmdLine are null
*/
public List<String> tabComplete(CommandSender sender, String cmdLine) throws IllegalArgumentException;
@Nullable
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine) throws IllegalArgumentException;
/**
* Looks for the requested command and executes an appropriate
@@ -122,5 +126,6 @@ public interface CommandMap {
* command fails with an unhandled exception
* @throws IllegalArgumentException if either sender or cmdLine are null
*/
public List<String> tabComplete(CommandSender sender, String cmdLine, Location location) throws IllegalArgumentException;
@Nullable
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) throws IllegalArgumentException;
}