From 5fd42f707ed326503b3c29fb3ac61342403967bf Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 16 Feb 2017 11:38:41 +0300 Subject: [PATCH] assertion for strange memory leak --- .../com/intellij/util/indexing/IndexConfiguration.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexConfiguration.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexConfiguration.java index 37ae8216dab5..c0b8a189b588 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/IndexConfiguration.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexConfiguration.java @@ -59,11 +59,10 @@ class IndexConfiguration { } void registerIndex(ID name, - UpdatableIndex index, + @NotNull UpdatableIndex index, FileBasedIndex.InputFilter inputFilter, int version, - @Nullable Collection associatedFileTypes - ) { + @Nullable Collection associatedFileTypes) { assert !myFreezed; synchronized (myIndices) { @@ -79,7 +78,10 @@ class IndexConfiguration { myIndicesWithoutFileTypeInfo.add(name); } - myIndices.put(name, new Pair<>(index, inputFilter)); + Pair, FileBasedIndex.InputFilter> old = myIndices.put(name, new Pair<>(index, inputFilter)); + if (old != null) { + throw new IllegalStateException("Index " + old.first + " already registered for the name '" + name + "'"); + } } }