naming/src/main/java/org/wildfly/naming/java/permission/JndiPermission.java
public JndiPermission withNewActions(int actionBits) {
        actionBits &= ACTION_ALL;
        if (actionBits == this.actionBits) {
            return this;
        } else {
            return new JndiPermission(getName(), actionBits);
        }
    }
public JndiPermission withNewActions(int actionBits) {
        actionBits &= ACTION_ALL;
        if (actionBits == this.actionBits) {
            return this;
        } else {
            return new JndiPermission(getName(), actionBits);
        }
    }
Return a permission which is equal to this one except with its actions reset to {@code actionBits}.  If the given
{@code actionBits} equals the current bits of this permission, then this permission instance is returned; otherwise
a new permission is constructed. Any action bits which fall outside of {@link #ACTION_ALL} are silently ignored.

@param actionBits the action bits to use
@return a permission with only the given action bits (not {@code null})