code: public void setEntry(AclEntry entry) {
      switch (entry.getType()) {
        case NAMED_USER:  // fall through
        case NAMED_GROUP: // fall through
        case MASK:
          if (mExtendedEntries == null) {
            mExtendedEntries = new ExtendedACLEntries();
          }
          mExtendedEntries.setEntry(entry);
          return;
        case OWNING_USER:
          Mode modeOwner = new Mode(mMode);
          modeOwner.setOwnerBits(entry.getActions().toModeBits());
          mMode = modeOwner.toShort();
          return;
        case OWNING_GROUP:
          Mode modeGroup = new Mode(mMode);
          modeGroup.setGroupBits(entry.getActions().toModeBits());
          mMode = modeGroup.toShort();
          return;
        case OTHER:
          Mode modeOther = new Mode(mMode);
          modeOther.setOtherBits(entry.getActions().toModeBits());
          mMode = modeOther.toShort();
          return;
        default:
          throw new IllegalStateException("Unknown ACL entry type: " + entry.getType());
      }
    }
docs: Sets an entry into the access control list.
  If an entry with the same type and subject already exists, overwrites the existing entry;
  Otherwise, adds this new entry.
  After we modify entries for NAMED_GROUP, OWNING_GROUP, NAMED_USER, we need to update the mask.
  
  @param entry the entry to be added or updated