From 97121bc71993c53c589a2fd9a906146e8df2e9f9 Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 25 Apr 2018 21:02:17 +0100 Subject: [PATCH] Add some missing null check annotations --- api/src/main/java/me/lucko/luckperms/api/Track.java | 4 ++++ api/src/main/java/me/lucko/luckperms/api/User.java | 1 + .../lucko/luckperms/common/api/delegates/model/ApiTrack.java | 4 ++++ .../lucko/luckperms/common/api/delegates/model/ApiUser.java | 1 + 4 files changed, 10 insertions(+) diff --git a/api/src/main/java/me/lucko/luckperms/api/Track.java b/api/src/main/java/me/lucko/luckperms/api/Track.java index be92aafc..a3609289 100644 --- a/api/src/main/java/me/lucko/luckperms/api/Track.java +++ b/api/src/main/java/me/lucko/luckperms/api/Track.java @@ -120,6 +120,7 @@ public interface Track { * @throws NullPointerException if the group is null * @throws IllegalStateException if the group instance was not obtained from LuckPerms. */ + @Nonnull DataMutateResult appendGroup(@Nonnull Group group); /** @@ -132,6 +133,7 @@ public interface Track { * @throws NullPointerException if the group is null * @throws IllegalStateException if the group instance was not obtained from LuckPerms. */ + @Nonnull DataMutateResult insertGroup(@Nonnull Group group, int position) throws IndexOutOfBoundsException; /** @@ -142,6 +144,7 @@ public interface Track { * @throws NullPointerException if the group is null * @throws IllegalStateException if the group instance was not obtained from LuckPerms. */ + @Nonnull DataMutateResult removeGroup(@Nonnull Group group); /** @@ -151,6 +154,7 @@ public interface Track { * @return the result of the operation * @throws NullPointerException if the group is null */ + @Nonnull DataMutateResult removeGroup(@Nonnull String group); /** diff --git a/api/src/main/java/me/lucko/luckperms/api/User.java b/api/src/main/java/me/lucko/luckperms/api/User.java index 4c0bb4d4..0420a7e7 100644 --- a/api/src/main/java/me/lucko/luckperms/api/User.java +++ b/api/src/main/java/me/lucko/luckperms/api/User.java @@ -74,6 +74,7 @@ public interface User extends PermissionHolder { * @throws IllegalStateException if the user is not a member of that group * @throws NullPointerException if the group is null */ + @Nonnull DataMutateResult setPrimaryGroup(@Nonnull String group); /** diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiTrack.java b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiTrack.java index 0e49a17c..98371fd7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiTrack.java @@ -107,24 +107,28 @@ public final class ApiTrack implements me.lucko.luckperms.api.Track { return this.handle.demote(ApiUser.cast(user), contextSet, Predicates.alwaysTrue(), null); } + @Nonnull @Override public DataMutateResult appendGroup(@Nonnull Group group) { Objects.requireNonNull(group, "group"); return this.handle.appendGroup(ApiGroup.cast(group)); } + @Nonnull @Override public DataMutateResult insertGroup(@Nonnull Group group, int position) throws IndexOutOfBoundsException { Objects.requireNonNull(group, "group"); return this.handle.insertGroup(ApiGroup.cast(group), position); } + @Nonnull @Override public DataMutateResult removeGroup(@Nonnull Group group) { Objects.requireNonNull(group, "group"); return this.handle.removeGroup(ApiGroup.cast(group)); } + @Nonnull @Override public DataMutateResult removeGroup(@Nonnull String group) { Objects.requireNonNull(group, "group"); diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiUser.java b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiUser.java index 4ddd992d..504d84a0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiUser.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiUser.java @@ -72,6 +72,7 @@ public final class ApiUser extends ApiPermissionHolder implements me.lucko.luckp return this.handle.getPrimaryGroup().getValue(); } + @Nonnull @Override public DataMutateResult setPrimaryGroup(@Nonnull String group) { Objects.requireNonNull(group, "group");