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 2731d28dcb4f..1110a1b0c104 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -725,7 +725,7 @@ public final class FileBasedIndexImpl extends FileBasedIndex { ensureUpToDate(indexId, project, filter, null); } - protected void ensureUpToDate(@NotNull final ID indexId, + void ensureUpToDate(@NotNull final ID indexId, @Nullable Project project, @Nullable GlobalSearchScope filter, @Nullable VirtualFile restrictedFile) { @@ -1912,7 +1912,7 @@ public final class FileBasedIndexImpl extends FileBasedIndex { } } - private FileTypeManagerImpl getFileTypeManager() { + private static FileTypeManagerImpl getFileTypeManager() { return (FileTypeManagerImpl)FileTypeManager.getInstance(); } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/HashIdForwardIndexAccessor.java b/platform/lang-impl/src/com/intellij/util/indexing/HashIdForwardIndexAccessor.java index 0b97d75a0f57..83fb5556d2b8 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/HashIdForwardIndexAccessor.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/HashIdForwardIndexAccessor.java @@ -37,7 +37,7 @@ class HashIdForwardIndexAccessor @Override public int serializeIndexedDataToInt(@NotNull InputData data) { - return data == InputData.empty() ? 0 : ((HashedInputData)data).getHashId(); + return data == InputData.empty() ? 0 : ((HashedInputData)data).getHashId(); } @Nullable diff --git a/platform/lang-impl/src/com/intellij/util/indexing/RebuildStatus.java b/platform/lang-impl/src/com/intellij/util/indexing/RebuildStatus.java index 64031cd7cde2..03878dc6ff3e 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/RebuildStatus.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/RebuildStatus.java @@ -32,7 +32,7 @@ enum RebuildStatus { return ourRebuildStatus.get(indexId).compareAndSet(OK, REQUIRES_REBUILD); } - static void clearIndexIfNecessary(ID indexId, ThrowableRunnable clearAction) throws StorageException { + static void clearIndexIfNecessary(ID indexId, ThrowableRunnable clearAction) throws StorageException { AtomicReference rebuildStatus = ourRebuildStatus.get(indexId); if (rebuildStatus == null) { throw new StorageException("Problem updating " + indexId); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/SharedIndicesData.java b/platform/lang-impl/src/com/intellij/util/indexing/SharedIndicesData.java index f85e54644daa..f09ab41524de 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/SharedIndicesData.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/SharedIndicesData.java @@ -115,15 +115,12 @@ public class SharedIndicesData { } } - public static void init() { - } - private static final int CONTENTLESS = 1; private static final int CONTENTFUL = 2; static void registerIndex(@NotNull ID indexId, @NotNull IndexExtension extension) { if (extension instanceof FileBasedIndexExtension) { - boolean dependsOnFileContent = ((FileBasedIndexExtension)extension).dependsOnFileContent(); + boolean dependsOnFileContent = ((FileBasedIndexExtension)extension).dependsOnFileContent(); ourRegisteredIndices.put(indexId.getUniqueId(), dependsOnFileContent ? CONTENTFUL : CONTENTLESS); } } 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 3edbdac0b686..d39c92c67216 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/SnapshotInputMappings.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/SnapshotInputMappings.java @@ -198,7 +198,7 @@ class SnapshotInputMappings implements UpdatableSnapshotInput } @Override - public void close() throws IOException { + public void close() { Stream.of(myContents, myIndexingTrace).filter(Objects::nonNull).forEach(index -> { try { index.close(); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java index eb3b715691ab..b376367845c2 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java @@ -20,7 +20,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.Processor; import com.intellij.util.indexing.impl.AbstractUpdateData; -import com.intellij.util.indexing.impl.UpdateData; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; 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 68d3808e128f..cd51476a7630 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/VfsAwareMapReduceIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/VfsAwareMapReduceIndex.java @@ -113,7 +113,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex)mySnapshotInputMappings).putData(content, data); } catch (IOException e) { throw new RuntimeException(e); @@ -218,7 +218,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex keys) { - MemoryIndexStorage memoryIndexStorage = (MemoryIndexStorage)getStorage(); + MemoryIndexStorage memoryIndexStorage = (MemoryIndexStorage)getStorage(); boolean modified = false; for (Key key : keys) { if (memoryIndexStorage.clearMemoryMapForId(key, inputId) && !modified) { @@ -233,12 +233,12 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex)getStorage()).setBufferingEnabled(enabled); } @Override public void cleanupMemoryStorage() { - MemoryIndexStorage memStorage = (MemoryIndexStorage)getStorage(); + MemoryIndexStorage memStorage = (MemoryIndexStorage)getStorage(); ConcurrencyUtil.withLock(getWriteLock(), () -> memStorage.clearMemoryMap()); memStorage.fireMemoryStorageCleared(); } @@ -246,7 +246,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex memStorage = (MemoryIndexStorage)getStorage(); ConcurrencyUtil.withLock(getReadLock(), () -> memStorage.clearCaches()); } @@ -321,7 +321,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex)mySnapshotInputMappings).clear(); } catch (IOException e) { LOG.error(e); @@ -333,7 +333,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex)mySnapshotInputMappings).flush(); } } @@ -379,7 +379,7 @@ public class VfsAwareMapReduceIndex extends MapReduceIndex storage = getStorage(); if (storage instanceof MemoryIndexStorage) { - ((MemoryIndexStorage)storage).addBufferingStateListener(new MemoryIndexStorage.BufferingStateListener() { + ((MemoryIndexStorage)storage).addBufferingStateListener(new MemoryIndexStorage.BufferingStateListener() { @Override public void bufferingStateChanged(boolean newState) { myInMemoryMode.set(newState); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/hash/FileContentHashIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/hash/FileContentHashIndex.java index ded2ba1e4e14..ad65ba28491e 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/hash/FileContentHashIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/hash/FileContentHashIndex.java @@ -35,17 +35,14 @@ public class FileContentHashIndex extends VfsAwareMapReduceIndex data = getData(hash); - assert data.size() == 1; - return data.getValueIterator().getInputIdsIterator().next(); - } - catch (StorageException e) { - throw new RuntimeException(e); - } + return hash -> { + try { + ValueContainer data = getData(hash); + assert data.size() == 1; + return data.getValueIterator().getInputIdsIterator().next(); + } + catch (StorageException e) { + throw new RuntimeException(e); } }; } @@ -53,7 +50,7 @@ public class FileContentHashIndex extends VfsAwareMapReduceIndex { @NotNull private final Computable myUnderlying; - private boolean myEmptyInput; + private final boolean myEmptyInput; HashIndexUpdateComputable(@NotNull Computable underlying, boolean isEmptyInput) {myUnderlying = underlying; myEmptyInput = isEmptyInput; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/hash/HashBasedMapReduceIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/hash/HashBasedMapReduceIndex.java index 796678cc18ec..248745727ba4 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/hash/HashBasedMapReduceIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/hash/HashBasedMapReduceIndex.java @@ -7,9 +7,7 @@ import com.intellij.util.indexing.*; import com.intellij.util.indexing.impl.IndexStorage; import com.intellij.util.indexing.impl.MapIndexStorage; import com.intellij.util.indexing.provided.ProvidedIndexExtension; -import com.intellij.util.indexing.provided.ProvidedIndexExtensionLocator; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/hash/MergedInvertedIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/hash/MergedInvertedIndex.java index d55222cef5df..6c82ea1fe26d 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/hash/MergedInvertedIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/hash/MergedInvertedIndex.java @@ -7,7 +7,6 @@ import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.Processor; import com.intellij.util.indexing.*; import com.intellij.util.indexing.impl.AbstractUpdateData; -import com.intellij.util.indexing.impl.UpdateData; import com.intellij.util.indexing.provided.ProvidedIndexExtension; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/provided/ProvidedIndexExtensionLocator.java b/platform/lang-impl/src/com/intellij/util/indexing/provided/ProvidedIndexExtensionLocator.java index 5b4b7ce565b4..816a7d96f491 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/provided/ProvidedIndexExtensionLocator.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/provided/ProvidedIndexExtensionLocator.java @@ -3,7 +3,6 @@ package com.intellij.util.indexing.provided; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.util.indexing.FileBasedIndexExtension; -import com.intellij.util.indexing.ID; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;