code: private static void validateSetValueEntryForSet(Object entry, Set<?> set) {
      if (entry instanceof Set<?> || entry instanceof SetValue) {
        throw new IllegalArgumentException("Unsupported Value type [nested sets]");
      }
      if (!set.isEmpty()) {
        Object existingEntry = set.iterator().next();
        if (!existingEntry.getClass().isAssignableFrom(entry.getClass())) {
          throw new IllegalArgumentException(
              String.format(
                  "Unsupported Value type [SetValue with " + "mixed types %s and %s]",
                  existingEntry.getClass(), entry.getClass()));
        }
      }
    }
docs: Validates that an Object is a valid entry for a SetValue.
  
  @param entry the Object to validate
  @throws IllegalArgumentException if the Object is an unsupported type