static <K, V> IntSet registerIndexer(@NotNull final FileBasedIndexExtension<K, V> extension,
                                       @NotNull IndexConfiguration state,
                                       @NotNull IndexVersionRegistrationSink versionRegistrationStatusSink,
                                       @NotNull IntSet dirtyFiles) throws Exception {
    ID<K, V> name = extension.getName();
    int version = getIndexExtensionVersion(extension);

    IndexVersion.IndexVersionDiff diff = IndexVersion.versionDiffers(name, version);
    versionRegistrationStatusSink.setIndexVersionDiff(name, diff);
    if (diff != IndexVersion.IndexVersionDiff.UP_TO_DATE) {
      deleteIndexFiles(extension);
      IndexVersion.rewriteVersion(name, version);

      try {
        for (FileBasedIndexInfrastructureExtension ex : FileBasedIndexInfrastructureExtension.EP_NAME.getExtensionList()) {
          ex.onFileBasedIndexVersionChanged(name);
        }
      }
      catch (Exception e) {
        LOG.error(e);
      }
    }

    return initIndexStorage(extension, version, state, versionRegistrationStatusSink, dirtyFiles);
  }
static <K, V> IntSet registerIndexer(@NotNull final FileBasedIndexExtension<K, V> extension,
                                       @NotNull IndexConfiguration state,
                                       @NotNull IndexVersionRegistrationSink versionRegistrationStatusSink,
                                       @NotNull IntSet dirtyFiles)