docs: private void checkProspectiveMember(IGroupMember gm) throws GroupsException {
          if (gm.equals(this)) {
              throw new GroupsException("Attempt to add " + gm + " to itself.");
          }
  
          // Type check:
          if (this.getLeafType() != gm.getLeafType()) {
              throw new GroupsException(this + " and " + gm + " have different entity types.");
          }
  
          // Circular reference check:
          if (gm.isGroup() && gm.asGroup().deepContains(this)) {
              throw new GroupsException(
                      "Adding " + gm + " to " + this + " creates a circular reference.");
          }
      }