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

@@ -2,6 +2,7 @@ package org.bukkit.util;
import java.util.Collection;
import org.apache.commons.lang.Validate;
import org.jetbrains.annotations.NotNull;
public class StringUtil {
@@ -22,7 +23,8 @@ public class StringUtil {
* @throws IllegalArgumentException if originals contains a null element.
* <b>Note: the collection may be modified before this is thrown</b>
*/
public static <T extends Collection<? super String>> T copyPartialMatches(final String token, final Iterable<String> originals, final T collection) throws UnsupportedOperationException, IllegalArgumentException {
@NotNull
public static <T extends Collection<? super String>> T copyPartialMatches(@NotNull final String token, @NotNull final Iterable<String> originals, @NotNull final T collection) throws UnsupportedOperationException, IllegalArgumentException {
Validate.notNull(token, "Search token cannot be null");
Validate.notNull(collection, "Collection cannot be null");
Validate.notNull(originals, "Originals cannot be null");
@@ -48,7 +50,7 @@ public class StringUtil {
* @throws NullPointerException if prefix is null
* @throws IllegalArgumentException if string is null
*/
public static boolean startsWithIgnoreCase(final String string, final String prefix) throws IllegalArgumentException, NullPointerException {
public static boolean startsWithIgnoreCase(@NotNull final String string, @NotNull final String prefix) throws IllegalArgumentException, NullPointerException {
Validate.notNull(string, "Cannot check a null string for a match");
if (string.length() < prefix.length()) {
return false;