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,5 +1,8 @@
package org.bukkit.permissions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Holds information on a permission and which {@link PermissionAttachment}
* provides it
@@ -10,11 +13,11 @@ public class PermissionAttachmentInfo {
private final PermissionAttachment attachment;
private final boolean value;
public PermissionAttachmentInfo(Permissible permissible, String permission, PermissionAttachment attachment, boolean value) {
public PermissionAttachmentInfo(@NotNull Permissible permissible, @NotNull String permission, @Nullable PermissionAttachment attachment, boolean value) {
if (permissible == null) {
throw new IllegalArgumentException("Permissible may not be null");
} else if (permission == null) {
throw new IllegalArgumentException("Permissions may not be null");
throw new IllegalArgumentException("Permission may not be null");
}
this.permissible = permissible;
@@ -28,6 +31,7 @@ public class PermissionAttachmentInfo {
*
* @return Permissible this permission is for
*/
@NotNull
public Permissible getPermissible() {
return permissible;
}
@@ -37,6 +41,7 @@ public class PermissionAttachmentInfo {
*
* @return Name of the permission
*/
@NotNull
public String getPermission() {
return permission;
}
@@ -47,6 +52,7 @@ public class PermissionAttachmentInfo {
*
* @return Attachment
*/
@Nullable
public PermissionAttachment getAttachment() {
return attachment;
}