private static @NotNull Map<String, NullableLazyValue<XmlNSDescriptor>> initializeSchema(final @NotNull XmlTag tag,
                                                                                           final @Nullable String namespace,
                                                                                           final @Nullable String version,
                                                                                           final @NotNull Set<String> fileLocations,
                                                                                           @Nullable Map<String, NullableLazyValue<XmlNSDescriptor>> map,
                                                                                           final boolean nsDecl) {
    if (map == null) {
      map = new HashMap<>();
    }

    // We put cached value in any case to cause its value update on e.g. mapping change
    map.put(namespace, lazyNullable(() -> {
      List<XmlNSDescriptor> descriptors =
        ContainerUtil.mapNotNull(fileLocations, s -> getDescriptor(tag, retrieveFile(tag, s, version, namespace, nsDecl), s, namespace));

      XmlNSDescriptor descriptor = null;
      if (descriptors.size() == 1) {
        descriptor = descriptors.get(0);
      }
      else if (descriptors.size() > 1) {
        descriptor = new MultiFileNsDescriptor(ContainerUtil.map(descriptors, descriptor1 -> (XmlNSDescriptorImpl)descriptor1));
      }
      if (descriptor == null) {
        return null;
      }
      XmlExtension extension = XmlExtension.getExtensionByElement(tag);
      if (extension != null) {
        String prefix = tag.getPrefixByNamespace(namespace);
        descriptor = extension.wrapNSDescriptor(tag, ObjectUtils.notNull(prefix, ""), descriptor);
      }
      return descriptor;
    }));

    return map;
  }
private static @NotNull Map<String, NullableLazyValue<XmlNSDescriptor>> initializeSchema(final @NotNull XmlTag tag,
                                                                                           final @Nullable String namespace,
                                                                                           final @Nullable String version,
                                                                                           final @NotNull Set<String> fileLocations,
                                                                                           @Nullable Map<String, NullableLazyValue<XmlNSDescriptor>> map,
                                                                                           final boolean nsDecl)