Add some missing null check annotations

This commit is contained in:
Luck 2018-04-25 21:02:17 +01:00
parent 1312aac349
commit 97121bc719
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
4 changed files with 10 additions and 0 deletions

View File

@ -120,6 +120,7 @@ public interface Track {
* @throws NullPointerException if the group is null * @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms. * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/ */
@Nonnull
DataMutateResult appendGroup(@Nonnull Group group); DataMutateResult appendGroup(@Nonnull Group group);
/** /**
@ -132,6 +133,7 @@ public interface Track {
* @throws NullPointerException if the group is null * @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms. * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/ */
@Nonnull
DataMutateResult insertGroup(@Nonnull Group group, int position) throws IndexOutOfBoundsException; DataMutateResult insertGroup(@Nonnull Group group, int position) throws IndexOutOfBoundsException;
/** /**
@ -142,6 +144,7 @@ public interface Track {
* @throws NullPointerException if the group is null * @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms. * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/ */
@Nonnull
DataMutateResult removeGroup(@Nonnull Group group); DataMutateResult removeGroup(@Nonnull Group group);
/** /**
@ -151,6 +154,7 @@ public interface Track {
* @return the result of the operation * @return the result of the operation
* @throws NullPointerException if the group is null * @throws NullPointerException if the group is null
*/ */
@Nonnull
DataMutateResult removeGroup(@Nonnull String group); DataMutateResult removeGroup(@Nonnull String group);
/** /**

View File

@ -74,6 +74,7 @@ public interface User extends PermissionHolder {
* @throws IllegalStateException if the user is not a member of that group * @throws IllegalStateException if the user is not a member of that group
* @throws NullPointerException if the group is null * @throws NullPointerException if the group is null
*/ */
@Nonnull
DataMutateResult setPrimaryGroup(@Nonnull String group); DataMutateResult setPrimaryGroup(@Nonnull String group);
/** /**

View File

@ -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); return this.handle.demote(ApiUser.cast(user), contextSet, Predicates.alwaysTrue(), null);
} }
@Nonnull
@Override @Override
public DataMutateResult appendGroup(@Nonnull Group group) { public DataMutateResult appendGroup(@Nonnull Group group) {
Objects.requireNonNull(group, "group"); Objects.requireNonNull(group, "group");
return this.handle.appendGroup(ApiGroup.cast(group)); return this.handle.appendGroup(ApiGroup.cast(group));
} }
@Nonnull
@Override @Override
public DataMutateResult insertGroup(@Nonnull Group group, int position) throws IndexOutOfBoundsException { public DataMutateResult insertGroup(@Nonnull Group group, int position) throws IndexOutOfBoundsException {
Objects.requireNonNull(group, "group"); Objects.requireNonNull(group, "group");
return this.handle.insertGroup(ApiGroup.cast(group), position); return this.handle.insertGroup(ApiGroup.cast(group), position);
} }
@Nonnull
@Override @Override
public DataMutateResult removeGroup(@Nonnull Group group) { public DataMutateResult removeGroup(@Nonnull Group group) {
Objects.requireNonNull(group, "group"); Objects.requireNonNull(group, "group");
return this.handle.removeGroup(ApiGroup.cast(group)); return this.handle.removeGroup(ApiGroup.cast(group));
} }
@Nonnull
@Override @Override
public DataMutateResult removeGroup(@Nonnull String group) { public DataMutateResult removeGroup(@Nonnull String group) {
Objects.requireNonNull(group, "group"); Objects.requireNonNull(group, "group");

View File

@ -72,6 +72,7 @@ public final class ApiUser extends ApiPermissionHolder implements me.lucko.luckp
return this.handle.getPrimaryGroup().getValue(); return this.handle.getPrimaryGroup().getValue();
} }
@Nonnull
@Override @Override
public DataMutateResult setPrimaryGroup(@Nonnull String group) { public DataMutateResult setPrimaryGroup(@Nonnull String group) {
Objects.requireNonNull(group, "group"); Objects.requireNonNull(group, "group");