From 5763152d22c9d7ce02b7d214ee4cc6ec3e824fcd Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 24 Sep 2018 21:30:31 +0200 Subject: [PATCH] do not modify passed list --- .../com/intellij/util/indexing/FileBasedIndexImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index c9efb885297d..d16a186ef4c3 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -313,7 +313,7 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent, public void initComponent() { long started = System.nanoTime(); List extensions = IndexInfrastructure.hasIndices() ? - FileBasedIndexExtension.EXTENSION_POINT_NAME.getExtensionList() : Collections.emptyList(); + FileBasedIndexExtension.EXTENSION_POINT_NAME.getExtensionList() : Collections.emptyList(); LOG.info("Index exts enumerated:" + (System.nanoTime() - started) / 1000000 + ", number of extensions:" + extensions.size()); started = System.nanoTime(); @@ -2353,9 +2353,12 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent, private boolean currentVersionCorrupted; private SerializationManagerEx mySerializationManagerEx; - FileIndexDataInitialization(List extensions) { + FileIndexDataInitialization(@NotNull List extensions) { // init contentless indices first - extensions.sort(Comparator.comparingInt(o -> o.dependsOnFileContent() ? 1 : 0)); + if (!extensions.isEmpty()) { + extensions = ContainerUtil.copyList(extensions); + extensions.sort(Comparator.comparingInt(o -> o.dependsOnFileContent() ? 1 : 0)); + } for (FileBasedIndexExtension extension : extensions) { ID name = extension.getName(); RebuildStatus.registerIndex(name);