mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup: fix yellow code
GitOrigin-RevId: b4caa5814c0b0df9594a49651111976c2b53123c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
283b2ad9ed
commit
9d9da2c065
@@ -725,7 +725,7 @@ public final class FileBasedIndexImpl extends FileBasedIndex {
|
||||
ensureUpToDate(indexId, project, filter, null);
|
||||
}
|
||||
|
||||
protected <K> void ensureUpToDate(@NotNull final ID<K, ?> indexId,
|
||||
<K> void ensureUpToDate(@NotNull final ID<K, ?> 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class HashIdForwardIndexAccessor<Key, Value, Input>
|
||||
|
||||
@Override
|
||||
public int serializeIndexedDataToInt(@NotNull InputData<Key, Value> data) {
|
||||
return data == InputData.empty() ? 0 : ((HashedInputData)data).getHashId();
|
||||
return data == InputData.empty() ? 0 : ((HashedInputData<Key, Value>)data).getHashId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -32,7 +32,7 @@ enum RebuildStatus {
|
||||
return ourRebuildStatus.get(indexId).compareAndSet(OK, REQUIRES_REBUILD);
|
||||
}
|
||||
|
||||
static void clearIndexIfNecessary(ID<?, ?> indexId, ThrowableRunnable<StorageException> clearAction) throws StorageException {
|
||||
static void clearIndexIfNecessary(ID<?, ?> indexId, ThrowableRunnable<? extends StorageException> clearAction) throws StorageException {
|
||||
AtomicReference<RebuildStatus> rebuildStatus = ourRebuildStatus.get(indexId);
|
||||
if (rebuildStatus == null) {
|
||||
throw new StorageException("Problem updating " + indexId);
|
||||
|
||||
@@ -115,15 +115,12 @@ public class SharedIndicesData {
|
||||
}
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
}
|
||||
|
||||
private static final int CONTENTLESS = 1;
|
||||
private static final int CONTENTFUL = 2;
|
||||
|
||||
static <Key, Value, Input> void registerIndex(@NotNull ID<Key, Value> indexId, @NotNull IndexExtension<Key, Value, Input> extension) {
|
||||
if (extension instanceof FileBasedIndexExtension) {
|
||||
boolean dependsOnFileContent = ((FileBasedIndexExtension)extension).dependsOnFileContent();
|
||||
boolean dependsOnFileContent = ((FileBasedIndexExtension<?, ?>)extension).dependsOnFileContent();
|
||||
ourRegisteredIndices.put(indexId.getUniqueId(), dependsOnFileContent ? CONTENTFUL : CONTENTLESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class SnapshotInputMappings<Key, Value, Input> implements UpdatableSnapshotInput
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
Stream.of(myContents, myIndexingTrace).filter(Objects::nonNull).forEach(index -> {
|
||||
try {
|
||||
index.close();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
data = super.mapInput(content);
|
||||
if (!containsSnapshotData && !UpdatableSnapshotInputMappingIndex.ignoreMappingIndexUpdate(content)) {
|
||||
try {
|
||||
return ((UpdatableSnapshotInputMappingIndex)mySnapshotInputMappings).putData(content, data);
|
||||
return ((UpdatableSnapshotInputMappingIndex<Key, Value, Input>)mySnapshotInputMappings).putData(content, data);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -218,7 +218,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
|
||||
@Override
|
||||
public void removeTransientDataForKeys(int inputId, @NotNull Collection<? extends Key> keys) {
|
||||
MemoryIndexStorage memoryIndexStorage = (MemoryIndexStorage)getStorage();
|
||||
MemoryIndexStorage<Key, Value> memoryIndexStorage = (MemoryIndexStorage<Key, Value>)getStorage();
|
||||
boolean modified = false;
|
||||
for (Key key : keys) {
|
||||
if (memoryIndexStorage.clearMemoryMapForId(key, inputId) && !modified) {
|
||||
@@ -233,12 +233,12 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
|
||||
@Override
|
||||
public void setBufferingEnabled(boolean enabled) {
|
||||
((MemoryIndexStorage)getStorage()).setBufferingEnabled(enabled);
|
||||
((MemoryIndexStorage<Key, Value>)getStorage()).setBufferingEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupMemoryStorage() {
|
||||
MemoryIndexStorage memStorage = (MemoryIndexStorage)getStorage();
|
||||
MemoryIndexStorage<Key, Value> memStorage = (MemoryIndexStorage<Key, Value>)getStorage();
|
||||
ConcurrencyUtil.withLock(getWriteLock(), () -> memStorage.clearMemoryMap());
|
||||
memStorage.fireMemoryStorageCleared();
|
||||
}
|
||||
@@ -246,7 +246,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
@TestOnly
|
||||
@Override
|
||||
public void cleanupForNextTest() {
|
||||
MemoryIndexStorage memStorage = (MemoryIndexStorage)getStorage();
|
||||
MemoryIndexStorage<Key, Value> memStorage = (MemoryIndexStorage<Key, Value>)getStorage();
|
||||
ConcurrencyUtil.withLock(getReadLock(), () -> memStorage.clearCaches());
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
super.doClear();
|
||||
if (mySnapshotInputMappings != null && myUpdateMappings) {
|
||||
try {
|
||||
((UpdatableSnapshotInputMappingIndex)mySnapshotInputMappings).clear();
|
||||
((UpdatableSnapshotInputMappingIndex<Key, Value, Input>)mySnapshotInputMappings).clear();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
@@ -333,7 +333,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
protected void doFlush() throws IOException, StorageException {
|
||||
super.doFlush();
|
||||
if (mySnapshotInputMappings != null && myUpdateMappings) {
|
||||
((UpdatableSnapshotInputMappingIndex)mySnapshotInputMappings).flush();
|
||||
((UpdatableSnapshotInputMappingIndex<Key, Value, Input>)mySnapshotInputMappings).flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
|
||||
private void installMemoryModeListener() {
|
||||
IndexStorage<Key, Value> storage = getStorage();
|
||||
if (storage instanceof MemoryIndexStorage) {
|
||||
((MemoryIndexStorage)storage).addBufferingStateListener(new MemoryIndexStorage.BufferingStateListener() {
|
||||
((MemoryIndexStorage<Key, Value>)storage).addBufferingStateListener(new MemoryIndexStorage.BufferingStateListener() {
|
||||
@Override
|
||||
public void bufferingStateChanged(boolean newState) {
|
||||
myInMemoryMode.set(newState);
|
||||
|
||||
@@ -35,17 +35,14 @@ public class FileContentHashIndex extends VfsAwareMapReduceIndex<Integer, Void,
|
||||
|
||||
@NotNull
|
||||
IntIntFunction toHashIdToFileIdFunction() {
|
||||
return new IntIntFunction() {
|
||||
@Override
|
||||
public int fun(int hash) {
|
||||
try {
|
||||
ValueContainer<Void> data = getData(hash);
|
||||
assert data.size() == 1;
|
||||
return data.getValueIterator().getInputIdsIterator().next();
|
||||
}
|
||||
catch (StorageException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return hash -> {
|
||||
try {
|
||||
ValueContainer<Void> 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<Integer, Void,
|
||||
final static class HashIndexUpdateComputable implements Computable<Boolean> {
|
||||
@NotNull
|
||||
private final Computable<Boolean> myUnderlying;
|
||||
private boolean myEmptyInput;
|
||||
private final boolean myEmptyInput;
|
||||
|
||||
HashIndexUpdateComputable(@NotNull Computable<Boolean> underlying, boolean isEmptyInput) {myUnderlying = underlying;
|
||||
myEmptyInput = isEmptyInput;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user