diff --git a/java/java-tests/testSrc/com/intellij/index/StringIndex.java b/java/java-tests/testSrc/com/intellij/index/StringIndex.java index d9c977ecf8b5..eb443cf88db4 100644 --- a/java/java-tests/testSrc/com/intellij/index/StringIndex.java +++ b/java/java-tests/testSrc/com/intellij/index/StringIndex.java @@ -15,6 +15,7 @@ */ package com.intellij.index; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.indexing.*; import com.intellij.util.indexing.impl.IndexStorage; @@ -46,11 +47,11 @@ public class StringIndex { final PersistentHashMap> inputIndex, boolean failOnRebuildRequest) throws IOException { - ID id = ID.create(testName + "string_index"); + IndexId id = IndexId.create(testName + "string_index"); IndexExtension extension = new IndexExtension() { @NotNull @Override - public ID getName() { + public IndexId getName() { return id; } @@ -77,13 +78,18 @@ public class StringIndex { return 0; } }; - myIndex = new VfsAwareMapReduceIndex(extension, storage, new MapBasedForwardIndex(extension) { + myIndex = new MapReduceIndex(extension, storage, new MapBasedForwardIndex(extension) { @NotNull @Override public PersistentHashMap> createMap() throws IOException { return inputIndex; } }) { + @Override + public void checkCanceled() { + ProgressManager.checkCanceled(); + } + @Override public void requestRebuild(@NotNull Exception ex) { if (failOnRebuildRequest) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/CompilerBackwardReferenceIndex.java b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/CompilerBackwardReferenceIndex.java index cc6c9dcf7a45..60db2ec2204d 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/CompilerBackwardReferenceIndex.java +++ b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/CompilerBackwardReferenceIndex.java @@ -21,8 +21,8 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.CommonProcessors; import com.intellij.util.Processor; -import com.intellij.util.indexing.ID; import com.intellij.util.indexing.IndexExtension; +import com.intellij.util.indexing.IndexId; import com.intellij.util.indexing.InvertedIndex; import com.intellij.util.indexing.impl.*; import com.intellij.util.io.*; @@ -43,7 +43,7 @@ public class CompilerBackwardReferenceIndex { private final static String NAME_ENUM_TAB = "name.tab"; private static final String VERSION_FILE = "version"; - private final Map, InvertedIndex> myIndices; + private final Map, InvertedIndex> myIndices; private final NameEnumerator myNameEnumerator; private final PersistentStringEnumerator myFilePathEnumerator; private final File myIndicesDir; @@ -102,7 +102,7 @@ public class CompilerBackwardReferenceIndex { return myIndices.values(); } - public InvertedIndex get(ID key) { + public InvertedIndex get(IndexId key) { //noinspection unchecked return (InvertedIndex)myIndices.get(key); } @@ -255,8 +255,8 @@ public class CompilerBackwardReferenceIndex { @NotNull @Override public PersistentHashMap> createMap() throws IOException { - ID id = extension.getName(); - return new PersistentHashMap<>(new File(indexDir, id + ".inputs"), + IndexId id = extension.getName(); + return new PersistentHashMap<>(new File(indexDir, id.getName() + ".inputs"), EnumeratorIntegerDescriptor.INSTANCE, new InputIndexDataExternalizer<>(extension.getKeyDescriptor(), id)); @@ -277,10 +277,10 @@ public class CompilerBackwardReferenceIndex { private static IndexStorage createIndexStorage(@NotNull KeyDescriptor keyDescriptor, @NotNull DataExternalizer valueExternalizer, - @NotNull ID indexId, + @NotNull IndexId indexId, @NotNull File indexDir, boolean readOnly) throws IOException { - return new MapIndexStorage(new File(indexDir, indexId.toString()), + return new MapIndexStorage(new File(indexDir, indexId.getName()), keyDescriptor, valueExternalizer, 16 * 1024, diff --git a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/index/CompilerIndices.java b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/index/CompilerIndices.java index 9245cf817052..ec8f5a618e29 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/index/CompilerIndices.java +++ b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/index/CompilerIndices.java @@ -16,9 +16,7 @@ package org.jetbrains.jps.backwardRefs.index; import com.intellij.openapi.util.io.DataInputOutputUtilRt; -import com.intellij.util.indexing.DataIndexer; -import com.intellij.util.indexing.ID; -import com.intellij.util.indexing.IndexExtension; +import com.intellij.util.indexing.*; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.DataInputOutputUtil; import com.intellij.util.io.KeyDescriptor; @@ -39,10 +37,10 @@ public class CompilerIndices { //TODO manage version separately public final static int VERSION = 5; - public final static ID BACK_USAGES = ID.create("back.refs"); - public final static ID> BACK_HIERARCHY = ID.create("back.hierarchy"); - public final static ID BACK_CLASS_DEF = ID.create("back.class.def"); - public final static ID> BACK_MEMBER_SIGN = ID.create("back.member.sign"); + public final static IndexId BACK_USAGES = IndexId.create("back.refs"); + public final static IndexId> BACK_HIERARCHY = IndexId.create("back.hierarchy"); + public final static IndexId BACK_CLASS_DEF = IndexId.create("back.class.def"); + public final static IndexId> BACK_MEMBER_SIGN = IndexId.create("back.member.sign"); public static List> getIndices() { return Arrays.asList(createBackwardClassDefinitionExtension(), @@ -59,7 +57,7 @@ public class CompilerIndices { } @NotNull - public ID getName() { + public IndexId getName() { return BACK_USAGES; } @@ -104,7 +102,7 @@ public class CompilerIndices { } @NotNull - public ID> getName() { + public IndexId> getName() { return BACK_HIERARCHY; } @@ -133,7 +131,7 @@ public class CompilerIndices { } @NotNull - public ID getName() { + public IndexId getName() { return BACK_CLASS_DEF; } @@ -158,7 +156,7 @@ public class CompilerIndices { return new IndexExtension, CompiledFileData>() { @NotNull @Override - public ID> getName() { + public IndexId> getName() { return BACK_MEMBER_SIGN; } diff --git a/jps/jps-builders/testSrc/org/jetbrains/references/ReferenceIndexTestBase.kt b/jps/jps-builders/testSrc/org/jetbrains/references/ReferenceIndexTestBase.kt index e648b3051838..742ae34b7423 100644 --- a/jps/jps-builders/testSrc/org/jetbrains/references/ReferenceIndexTestBase.kt +++ b/jps/jps-builders/testSrc/org/jetbrains/references/ReferenceIndexTestBase.kt @@ -18,7 +18,7 @@ package org.jetbrains.references import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.vfs.CharsetToolkit import com.intellij.util.PathUtil -import com.intellij.util.indexing.ID +import com.intellij.util.indexing.IndexId import com.intellij.util.indexing.impl.MapIndexStorage import com.intellij.util.indexing.impl.MapReduceIndex import com.intellij.util.io.PersistentStringEnumerator @@ -168,7 +168,7 @@ abstract class ReferenceIndexTestBase : JpsBuildTestCase() { } } - private fun storage(index: CompilerBackwardReferenceIndex, id: ID) = (index[id] as MapReduceIndex).storage as MapIndexStorage + private fun storage(index: CompilerBackwardReferenceIndex, id: IndexId) = (index[id] as MapReduceIndex).storage as MapIndexStorage private fun getTestDataPath() = testDataRootPath + "/" + getTestName(true) + "/" diff --git a/platform/util/src/com/intellij/util/indexing/ID.java b/platform/core-api/src/com/intellij/util/indexing/ID.java similarity index 96% rename from platform/util/src/com/intellij/util/indexing/ID.java rename to platform/core-api/src/com/intellij/util/indexing/ID.java index cd35eed1cc5d..b6dda901cf96 100644 --- a/platform/util/src/com/intellij/util/indexing/ID.java +++ b/platform/core-api/src/com/intellij/util/indexing/ID.java @@ -31,12 +31,11 @@ import java.io.*; * @author Eugene Zhuravlev * Date: Feb 12, 2008 */ -public class ID { +public class ID extends IndexId { private static final ConcurrentIntObjectMap ourRegistry = ContainerUtil.createConcurrentIntObjectMap(); private static final TObjectIntHashMap ourNameToIdRegistry = new TObjectIntHashMap(); static final int MAX_NUMBER_OF_INDICES = Short.MAX_VALUE; - private final String myName; private final short myUniqueId; static { @@ -83,7 +82,7 @@ public class ID { } protected ID(String name) { - myName = name; + super(name); myUniqueId = stringToId(name); final ID old = ourRegistry.put(myUniqueId, this); @@ -155,8 +154,11 @@ public class ID { return (int)myUniqueId; } + /** + * Consider to use {@link ID#getName()} instead of this method + */ public String toString() { - return myName; + return getName(); } public int getUniqueId() { diff --git a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java index ea63f3e59d52..1cddee3ddf77 100644 --- a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java +++ b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java @@ -32,6 +32,10 @@ public abstract class FileBasedIndexExtension extends IndexExtension EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.fileBasedIndex"); public static final int DEFAULT_CACHE_SIZE = 1024; + @NotNull + @Override + public abstract ID getName(); + @NotNull public abstract FileBasedIndex.InputFilter getInputFilter(); 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 c5ca569b7185..6d5c9350dd64 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java @@ -538,7 +538,7 @@ public class StubIndexImpl extends StubIndex implements PersistentStateComponent final Set indicesToDrop = new HashSet<>(myPreviouslyRegistered != null ? myPreviouslyRegistered.registeredIndices : Collections.emptyList()); for (ID key : state.myIndices.keySet()) { - indicesToDrop.remove(key.toString()); + indicesToDrop.remove(key.getName()); } if (!indicesToDrop.isEmpty()) { diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexState.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexState.java index 86c89f9c0688..0a3b287e30b5 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexState.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexState.java @@ -33,7 +33,7 @@ public class StubIndexState { public StubIndexState(@NotNull Collection> keys) { for (StubIndexKey key : keys) { - registeredIndices.add(key.toString()); + registeredIndices.add(key.getName()); } } } 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 fbcbef4399da..2a2e8d3a9518 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -428,7 +428,7 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent, catch (IOException ignored) { } for (ID key : ids) { - indicesToDrop.remove(key.toString()); + indicesToDrop.remove(key.getName()); } if (!indicesToDrop.isEmpty()) { LOG.info("Dropping indices:" + StringUtil.join(indicesToDrop, ",")); @@ -441,7 +441,7 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent, try (DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(registeredIndicesFile)))) { os.writeInt(ids.size()); for (ID id : ids) { - IOUtil.writeString(id.toString(), os); + IOUtil.writeString(id.getName(), os); } } catch (IOException ignored) { diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexAccessValidator.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexAccessValidator.java index 0244ee9064dd..483432440250 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/IndexAccessValidator.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexAccessValidator.java @@ -31,8 +31,8 @@ public class IndexAccessValidator { final ID alreadyProcessingIndex = ourAlreadyProcessingIndices.get(); if (alreadyProcessingIndex != null && alreadyProcessingIndex != indexKey) { final String message = MessageFormat.format("Accessing ''{0}'' during processing ''{1}''. Nested different indices processing may cause deadlock", - indexKey.toString(), - alreadyProcessingIndex.toString()); + indexKey.getName(), + alreadyProcessingIndex.getUniqueId()); if (ApplicationManager.getApplication().isUnitTestMode()) throw new RuntimeException(message); Logger.getInstance(FileBasedIndexImpl.class).error(message); // RuntimeException to skip rebuild } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java index 1076ed3da78e..2d9a7f1d483a 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java @@ -66,7 +66,7 @@ public class IndexInfrastructure { @NotNull public static File getStorageFile(@NotNull ID indexName) { - return new File(getIndexRootDir(indexName), indexName.toString()); + return new File(getIndexRootDir(indexName), indexName.getName()); } @NotNull @@ -97,7 +97,7 @@ public class IndexInfrastructure { @NotNull private static File getIndexDirectory(@NotNull ID indexName, boolean forVersion, String relativePath) { - final String dirName = indexName.toString().toLowerCase(Locale.US); + final String dirName = indexName.getName().toLowerCase(Locale.US); File indexDir; if (indexName instanceof StubIndexKey) { diff --git a/platform/lang-impl/src/com/intellij/util/indexing/SharedMapBasedForwardIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/SharedMapBasedForwardIndex.java index a89a9e44462a..fd07f7f87bac 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/SharedMapBasedForwardIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/SharedMapBasedForwardIndex.java @@ -40,14 +40,14 @@ class SharedMapBasedForwardIndex extends AbstractForwardIndex getDiffBuilder(int inputId) throws IOException { if (SharedIndicesData.ourFileSharedIndicesEnabled) { - Collection keys = SharedIndicesData.recallFileData(inputId, myIndexId, mySnapshotIndexExternalizer); + Collection keys = SharedIndicesData.recallFileData(inputId, (ID)myIndexId, mySnapshotIndexExternalizer); if (myUnderlying != null) { Collection keysFromInputsIndex = myUnderlying.getInputsIndex().get(inputId); if (keys == null && keysFromInputsIndex != null || !DebugAssertions.equals(keysFromInputsIndex, keys, myKeyDescriptor) ) { - SharedIndicesData.associateFileData(inputId, myIndexId, keysFromInputsIndex, mySnapshotIndexExternalizer); + SharedIndicesData.associateFileData(inputId, (ID)myIndexId, keysFromInputsIndex, mySnapshotIndexExternalizer); if (keys != null) { DebugAssertions.error( "Unexpected indexing diff " + myIndexId + ", file:" + IndexInfrastructure.findFileById(PersistentFS.getInstance(), inputId) @@ -68,7 +68,7 @@ class SharedMapBasedForwardIndex extends AbstractForwardIndex)myIndexId, keySeq, mySnapshotIndexExternalizer); } } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/SnapshotInputMappings.java b/platform/lang-impl/src/com/intellij/util/indexing/SnapshotInputMappings.java index d7beac03326c..91821d19b5cc 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/SnapshotInputMappings.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/SnapshotInputMappings.java @@ -59,7 +59,7 @@ public class SnapshotInputMappings { private boolean myIsPsiBackedIndex; public SnapshotInputMappings(IndexExtension indexExtension) throws IOException { - myIndexId = indexExtension.getName(); + myIndexId = (ID)indexExtension.getName(); myIsPsiBackedIndex = indexExtension instanceof PsiDependentIndex; mySnapshotIndexExternalizer = VfsAwareMapReduceIndex.createInputsIndexExternalizer(indexExtension); myValueExternalizer = indexExtension.getValueExternalizer(); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/VfsAwareMapReduceIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/VfsAwareMapReduceIndex.java index 60cf4cb2891d..b303d7e26c0b 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/VfsAwareMapReduceIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/VfsAwareMapReduceIndex.java @@ -63,7 +63,10 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex extension, @NotNull IndexStorage storage) throws IOException { super(extension, storage, getForwardIndex(extension)); - SharedIndicesData.registerIndex(myIndexId, extension); + if (!(myIndexId instanceof ID)) { + throw new IllegalArgumentException("myIndexId should be instance of com.intellij.util.indexing.ID"); + } + SharedIndicesData.registerIndex((ID)myIndexId, extension); mySnapshotInputMappings = myForwardIndex == null ? new SnapshotInputMappings<>(extension) : null; @@ -75,7 +78,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex storage, @NotNull ForwardIndex forwardIndex) throws IOException { super(extension, storage, forwardIndex); - SharedIndicesData.registerIndex(myIndexId, extension); + SharedIndicesData.registerIndex((ID)myIndexId, extension); mySnapshotInputMappings = myForwardIndex == null ? new SnapshotInputMappings<>(extension) : null; @@ -133,17 +136,17 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex)myIndexId); } @Override public void resetIndexedStateForFile(int fileId) { - IndexingStamp.setFileIndexedStateOutdated(fileId, myIndexId); + IndexingStamp.setFileIndexedStateOutdated(fileId, (ID)myIndexId); } @Override public boolean isIndexedStateForFile(int fileId, @NotNull VirtualFile file) { - return IndexingStamp.isFileIndexedStateCurrent(fileId, myIndexId); + return IndexingStamp.isFileIndexedStateCurrent(fileId, (ID)myIndexId); } @Override @@ -165,7 +168,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex FileBasedIndex.getInstance().requestRebuild(myIndexId, ex); + Runnable action = () -> FileBasedIndex.getInstance().requestRebuild((ID)myIndexId, ex); Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode() || application.isHeadlessEnvironment()) { // avoid deadlock due to synchronous update in DumbServiceImpl#queueTask @@ -229,7 +232,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex PersistentHashMap> createIdToDataKeysIndex(@NotNull IndexExtension extension) throws IOException { - final File indexStorageFile = IndexInfrastructure.getInputIndexStorageFile(extension.getName()); + final File indexStorageFile = IndexInfrastructure.getInputIndexStorageFile((ID)extension.getName()); return new PersistentHashMap<>(indexStorageFile, EnumeratorIntegerDescriptor.INSTANCE, createInputsIndexExternalizer(extension)); } } diff --git a/platform/util/src/com/intellij/util/indexing/IndexExtension.java b/platform/util/src/com/intellij/util/indexing/IndexExtension.java index 8b9b0081a9e1..4549a3689f22 100644 --- a/platform/util/src/com/intellij/util/indexing/IndexExtension.java +++ b/platform/util/src/com/intellij/util/indexing/IndexExtension.java @@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull; */ public abstract class IndexExtension { @NotNull - public abstract ID getName(); + public abstract IndexId getName(); @NotNull public abstract DataIndexer getIndexer(); diff --git a/platform/util/src/com/intellij/util/indexing/IndexId.java b/platform/util/src/com/intellij/util/indexing/IndexId.java new file mode 100644 index 000000000000..49b249986330 --- /dev/null +++ b/platform/util/src/com/intellij/util/indexing/IndexId.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.indexing; + +import gnu.trove.THashMap; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; + +@ApiStatus.Experimental +public class IndexId { + private static final Map> ourInstances = new THashMap>(); + + @NotNull + private final String myName; + + protected IndexId(@NotNull String name) {myName = name;} + + @NotNull + public final String getName() { + return myName; + } + + public static IndexId create(String name) { + @SuppressWarnings("unchecked") + IndexId id = (IndexId)ourInstances.get(name); + if (id == null) { + ourInstances.put(name, id = new IndexId(name)); + } + return id; + } +} diff --git a/platform/util/src/com/intellij/util/indexing/impl/AbstractForwardIndex.java b/platform/util/src/com/intellij/util/indexing/impl/AbstractForwardIndex.java index 58b969b020d0..4fef5e745097 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/AbstractForwardIndex.java +++ b/platform/util/src/com/intellij/util/indexing/impl/AbstractForwardIndex.java @@ -15,13 +15,13 @@ */ package com.intellij.util.indexing.impl; -import com.intellij.util.indexing.ID; import com.intellij.util.indexing.IndexExtension; +import com.intellij.util.indexing.IndexId; import com.intellij.util.io.KeyDescriptor; import org.jetbrains.annotations.NotNull; public abstract class AbstractForwardIndex implements ForwardIndex { - protected final ID myIndexId; + protected final IndexId myIndexId; protected final KeyDescriptor myKeyDescriptor; protected final IndexExtension myIndexExtension; diff --git a/platform/util/src/com/intellij/util/indexing/impl/InputIndexDataExternalizer.java b/platform/util/src/com/intellij/util/indexing/impl/InputIndexDataExternalizer.java index 749d960072c1..cf673118fb22 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/InputIndexDataExternalizer.java +++ b/platform/util/src/com/intellij/util/indexing/impl/InputIndexDataExternalizer.java @@ -15,7 +15,7 @@ */ package com.intellij.util.indexing.impl; -import com.intellij.util.indexing.ID; +import com.intellij.util.indexing.IndexId; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.DataInputOutputUtil; import com.intellij.util.io.KeyDescriptor; @@ -33,9 +33,9 @@ import java.util.List; */ public class InputIndexDataExternalizer implements DataExternalizer> { private final KeyDescriptor myKeyDescriptor; - private final ID myIndexId; + private final IndexId myIndexId; - public InputIndexDataExternalizer(KeyDescriptor keyDescriptor, ID indexId) { + public InputIndexDataExternalizer(KeyDescriptor keyDescriptor, IndexId indexId) { myKeyDescriptor = keyDescriptor; myIndexId = indexId; } diff --git a/platform/util/src/com/intellij/util/indexing/impl/MapReduceIndex.java b/platform/util/src/com/intellij/util/indexing/impl/MapReduceIndex.java index c08eb6ef92e4..2b0f8281b840 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/MapReduceIndex.java +++ b/platform/util/src/com/intellij/util/indexing/impl/MapReduceIndex.java @@ -42,7 +42,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; @ApiStatus.Experimental public abstract class MapReduceIndex implements InvertedIndex { private static final Logger LOG = Logger.getInstance("#com.intellij.util.indexing.impl.MapReduceIndex"); - @NotNull protected final ID myIndexId; + @NotNull protected final IndexId myIndexId; @NotNull protected final IndexStorage myStorage; protected final DataExternalizer myValueExternalizer; @@ -314,7 +314,7 @@ public abstract class MapReduceIndex implements InvertedIndex< } public static void checkValuesHaveProperEqualsAndHashCode(@NotNull Map data, - @NotNull ID indexId, + @NotNull IndexId indexId, @NotNull DataExternalizer valueExternalizer) { if (DebugAssertions.DEBUG) { for (Map.Entry e : data.entrySet()) { diff --git a/platform/util/src/com/intellij/util/indexing/impl/UpdateData.java b/platform/util/src/com/intellij/util/indexing/impl/UpdateData.java index 6f0e3eb04a7a..757a3c3255ec 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/UpdateData.java +++ b/platform/util/src/com/intellij/util/indexing/impl/UpdateData.java @@ -17,7 +17,7 @@ package com.intellij.util.indexing.impl; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.util.ThrowableRunnable; -import com.intellij.util.indexing.ID; +import com.intellij.util.indexing.IndexId; import com.intellij.util.indexing.StorageException; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -30,12 +30,12 @@ import java.util.Map; public class UpdateData { protected final Map myNewData; protected final ThrowableComputable, IOException> myCurrentDataEvaluator; - private final ID myIndexId; + private final IndexId myIndexId; private final ThrowableRunnable myForwardIndexUpdate; public UpdateData(@NotNull Map newData, @NotNull ThrowableComputable, IOException> currentDataEvaluator, - @NotNull ID indexId, + @NotNull IndexId indexId, @Nullable ThrowableRunnable forwardIndexUpdate) { myNewData = newData; myCurrentDataEvaluator = currentDataEvaluator; @@ -64,7 +64,7 @@ public class UpdateData { return myNewData; } - public ID getIndexId() { + public IndexId getIndexId() { return myIndexId; } diff --git a/platform/util/src/com/intellij/util/indexing/impl/ValueContainerImpl.java b/platform/util/src/com/intellij/util/indexing/impl/ValueContainerImpl.java index 64d666c1eadc..238280d9f3c9 100644 --- a/platform/util/src/com/intellij/util/indexing/impl/ValueContainerImpl.java +++ b/platform/util/src/com/intellij/util/indexing/impl/ValueContainerImpl.java @@ -19,7 +19,7 @@ package com.intellij.util.indexing.impl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.SmartList; import com.intellij.util.containers.EmptyIterator; -import com.intellij.util.indexing.ID; +import com.intellij.util.indexing.IndexId; import com.intellij.util.indexing.ValueContainer; import com.intellij.util.indexing.containers.ChangeBufferingList; import com.intellij.util.indexing.containers.IdSet; @@ -80,7 +80,7 @@ class ValueContainerImpl extends UpdatableValueContainer implement return myInputIdMapping != null ? myInputIdMapping instanceof THashMap ? ((THashMap)myInputIdMapping).size(): 1 : 0; } - static final ThreadLocal ourDebugIndexInfo = new ThreadLocal(); + static final ThreadLocal ourDebugIndexInfo = new ThreadLocal(); @Override public void removeAssociatedValue(int inputId) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogFullDetailsIndex.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogFullDetailsIndex.java index 98da81c19ed3..61470653fda3 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogFullDetailsIndex.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogFullDetailsIndex.java @@ -44,7 +44,7 @@ import static com.intellij.vcs.log.data.index.VcsLogPersistentIndex.getVersion; public class VcsLogFullDetailsIndex implements Disposable { protected static final String INDEX = "index"; @NotNull protected final MyMapReduceIndex myMapReduceIndex; - @NotNull private final ID myID; + @NotNull private final IndexId myID; @NotNull private final String myLogId; @NotNull private final String myName; @NotNull protected final DataIndexer myIndexer; @@ -59,7 +59,7 @@ public class VcsLogFullDetailsIndex implements Disposable { @NotNull FatalErrorHandler fatalErrorHandler, @NotNull Disposable disposableParent) throws IOException { - myID = ID.create(name); + myID = IndexId.create(name); myName = name; myLogId = logId; myIndexer = indexer; @@ -181,7 +181,7 @@ public class VcsLogFullDetailsIndex implements Disposable { @NotNull @Override - public ID getName() { + public IndexId getName() { return myID; }