private <R extends BuildRootDescriptor> void addRoots(@NotNull BuildDataPaths dataPaths, 
                                                        @NotNull Iterable<? extends AdditionalRootsProviderService> rootsProviders,
                                                        @NotNull BuildTarget<R> target,
                                                        @NotNull JpsModel model,
                                                        @NotNull ModuleExcludeIndex index,
                                                        @NotNull IgnoredFileIndex ignoredFileIndex) {
    List<R> descriptors = target.computeRootDescriptors(model, index, ignoredFileIndex, dataPaths);
    for (AdditionalRootsProviderService<?> provider : rootsProviders) {
      if (provider.getTargetTypes().contains(target.getTargetType())) {
        //noinspection unchecked
        AdditionalRootsProviderService<R> providerService = (AdditionalRootsProviderService<R>)provider;
        final List<R> additionalRoots = providerService.getAdditionalRoots(target, dataPaths);
        if (!additionalRoots.isEmpty()) {
          descriptors = new ArrayList<>(descriptors);
          descriptors.addAll(additionalRoots);
        }
      }
    }
    for (BuildRootDescriptor descriptor : descriptors) {
      registerDescriptor(descriptor);
    }
    if (descriptors instanceof ArrayList<?>) {
      ((ArrayList<?>)descriptors).trimToSize();
    }
    myRootsByTarget.put(target, descriptors);
  }
private <R extends BuildRootDescriptor> void addRoots(@NotNull BuildDataPaths dataPaths, 
                                                        @NotNull Iterable<? extends AdditionalRootsProviderService> rootsProviders,
                                                        @NotNull BuildTarget<R> target,
                                                        @NotNull JpsModel model,
                                                        @NotNull ModuleExcludeIndex index,
                                                        @NotNull IgnoredFileIndex ignoredFileIndex)