diff --git a/junixsocket-common/src/main/java/org/newsclub/net/unix/NamedIntegerBitmask.java b/junixsocket-common/src/main/java/org/newsclub/net/unix/NamedIntegerBitmask.java index e436bbea5..7cda08f4f 100644 --- a/junixsocket-common/src/main/java/org/newsclub/net/unix/NamedIntegerBitmask.java +++ b/junixsocket-common/src/main/java/org/newsclub/net/unix/NamedIntegerBitmask.java @@ -21,6 +21,7 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; @@ -83,7 +84,7 @@ public final int value() { * @return {@code true} iff set. */ public final boolean hasFlag(T flag) { - int v = flag.value(); + int v = Objects.requireNonNull(flag).value(); return (this.flags & v) == v; } @@ -102,8 +103,8 @@ public final String toString() { * @param other The other flag / flag set to merge. * @return An instance combining both. */ - @SuppressWarnings("PMD.ShortMethodName") - protected final T combineWith(T[] allFlags, T flagsNone, Constructor constr, T other) { + @SuppressWarnings({"PMD.ShortMethodName", "null"}) + protected final T combineWith(T[] allFlags, T flagsNone, Constructor<@NonNull T> constr, T other) { return resolve(allFlags, flagsNone, constr, value() | other.value()); }