public @Nullable JsonSchemaType mergeTypes(@Nullable JsonSchemaType selfType,
                                             @Nullable JsonSchemaType otherType,
                                             @Nullable Set<JsonSchemaType> otherTypeVariants) {
    if (selfType == null) return otherType;
    if (otherType == null) {
      if (otherTypeVariants != null && !otherTypeVariants.isEmpty()) {
        Set<JsonSchemaType> filteredVariants = EnumSet.noneOf(JsonSchemaType.class);
        for (JsonSchemaType variant : otherTypeVariants) {
          JsonSchemaType subtype = getSubtypeOfBoth(selfType, variant);
          if (subtype != null) filteredVariants.add(subtype);
        }
        if (filteredVariants.size() == 0) {
          myIsValidByExclusion = false;
          return selfType;
        }
        if (filteredVariants.size() == 1) {
          return filteredVariants.iterator().next();
        }
        return null; // will be handled by variants
      }
      return selfType;
    }

    JsonSchemaType subtypeOfBoth = getSubtypeOfBoth(selfType, otherType);
    if (subtypeOfBoth == null) {
      myIsValidByExclusion = false;
      return otherType;
    }
    return subtypeOfBoth;
  }
public @Nullable JsonSchemaType mergeTypes(@Nullable JsonSchemaType selfType,
                                             @Nullable JsonSchemaType otherType,
                                             @Nullable Set<JsonSchemaType> otherTypeVariants)