diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java index 3cd61172d534..22cbcbe9fab5 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java @@ -52,7 +52,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.function.IntPredicate; -import java.util.stream.Collectors; @State(name = "FileBasedIndex", storages = { @Storage(value = StoragePathMacros.CACHE_FILE), @@ -197,13 +196,14 @@ public final class StubIndexImpl extends StubIndexEx implements PersistentStateC UpdatableIndex index = new VfsAwareMapReduceIndex<>(wrappedExtension, memStorage, null, null, null, lock); if (stubUpdatingIndex instanceof MergedInvertedIndex) { - List> providedIndexExtensions = ((MergedInvertedIndex)stubUpdatingIndex) - .getProvidedExtensions() - .filter(ex -> ex instanceof StubProvidedIndexExtension) - .map(ex -> ((StubProvidedIndexExtension)ex).findProvidedStubIndex(extension)) - .collect(Collectors.toList()); - if (!providedIndexExtensions.isEmpty()) { - index = ProvidedIndexExtension.wrapWithProvidedIndex(providedIndexExtensions, wrappedExtension, index, ((MergedInvertedIndex)stubUpdatingIndex).getHashIndex()); + ProvidedIndexExtension ex = + ((MergedInvertedIndex)stubUpdatingIndex).getProvidedExtension(); + if (ex instanceof StubProvidedIndexExtension) { + ProvidedIndexExtension providedStubIndexExtension = + ((StubProvidedIndexExtension)ex).findProvidedStubIndex(extension); + if (providedStubIndexExtension != null) { + index = ProvidedIndexExtension.wrapWithProvidedIndex(providedStubIndexExtension, wrappedExtension, index); + } } }