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,8 @@
package org.bukkit.conversations;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List;
@@ -21,7 +23,7 @@ public abstract class FixedSetPrompt extends ValidatingPrompt {
* @param fixedSet A fixed set of strings, one of which the user must
* type.
*/
public FixedSetPrompt(String... fixedSet) {
public FixedSetPrompt(@NotNull String... fixedSet) {
super();
this.fixedSet = Arrays.asList(fixedSet);
}
@@ -29,7 +31,7 @@ public abstract class FixedSetPrompt extends ValidatingPrompt {
private FixedSetPrompt() {}
@Override
protected boolean isInputValid(ConversationContext context, String input) {
protected boolean isInputValid(@NotNull ConversationContext context, @NotNull String input) {
return fixedSet.contains(input);
}
@@ -40,6 +42,7 @@ public abstract class FixedSetPrompt extends ValidatingPrompt {
* @return the options formatted like "[bar, cheese, panda]" if bar,
* cheese, and panda were the options used
*/
@NotNull
protected String formatFixedSet() {
return "[" + StringUtils.join(fixedSet, ", ") + "]";
}