code: private void collectPropertyNamesHelper(
        Set<String> props, Set<PropertyMap> cache) {
      if (!cache.add(this)) {
        return;
      }
      props.addAll(properties.keySet());
      PropertyMap primaryParent = getPrimaryParent();
      if (primaryParent != null) {
        primaryParent.collectPropertyNamesHelper(props, cache);
      }
      for (ObjectType o : getSecondaryParentObjects()) {
        PropertyMap p = o.getPropertyMap();
        if (p != null) {
          p.collectPropertyNamesHelper(props, cache);
        }
      }
    }
docs: Use cache to avoid stack overflow.