mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use EnumeratorIntegerDescriptor.INSTANCE instead of new instance
This commit is contained in:
@@ -5,7 +5,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.io.IntInlineKeyDescriptor;
|
||||
import com.intellij.util.io.EnumeratorIntegerDescriptor;
|
||||
import gnu.trove.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -35,7 +35,6 @@ public class Mappings {
|
||||
private final static String SHORT_NAMES = "shortNames.tab";
|
||||
private final static String SOURCE_TO_CLASS = "sourceToClass.tab";
|
||||
private final static String CLASS_TO_SOURCE = "classToSource.tab";
|
||||
private static final IntInlineKeyDescriptor INT_KEY_DESCRIPTOR = new IntInlineKeyDescriptor();
|
||||
private static final int DEFAULT_SET_CAPACITY = 32;
|
||||
private static final float DEFAULT_SET_LOAD_FACTOR = 0.98f;
|
||||
private static final String IMPORT_WILDCARD_SUFFIX = ".*";
|
||||
@@ -136,15 +135,18 @@ public class Mappings {
|
||||
if (myIsDelta) {
|
||||
myRootDir.mkdirs();
|
||||
}
|
||||
myClassToSubclasses = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_SUBCLASSES), INT_KEY_DESCRIPTOR);
|
||||
myClassToClassDependency = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_CLASS), INT_KEY_DESCRIPTOR);
|
||||
myShortClassNameIndex = myIsDelta? null : new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, SHORT_NAMES), INT_KEY_DESCRIPTOR);
|
||||
myClassToSubclasses = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_SUBCLASSES),
|
||||
EnumeratorIntegerDescriptor.INSTANCE);
|
||||
myClassToClassDependency = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_CLASS),
|
||||
EnumeratorIntegerDescriptor.INSTANCE);
|
||||
myShortClassNameIndex = myIsDelta? null : new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, SHORT_NAMES),
|
||||
EnumeratorIntegerDescriptor.INSTANCE);
|
||||
mySourceFileToClasses = new ObjectObjectPersistentMultiMaplet<>(
|
||||
DependencyContext.getTableFile(myRootDir, SOURCE_TO_CLASS), new FileKeyDescriptor(), new ClassFileReprExternalizer(myContext),
|
||||
() -> new THashSet<>(5, DEFAULT_SET_LOAD_FACTOR)
|
||||
);
|
||||
myClassToSourceFile = new IntObjectPersistentMultiMaplet<>(
|
||||
DependencyContext.getTableFile(myRootDir, CLASS_TO_SOURCE), INT_KEY_DESCRIPTOR, new FileKeyDescriptor(), fileCollectionFactory
|
||||
DependencyContext.getTableFile(myRootDir, CLASS_TO_SOURCE), EnumeratorIntegerDescriptor.INSTANCE, new FileKeyDescriptor(), fileCollectionFactory
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ package org.jetbrains.jps.incremental.storage;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.io.DataExternalizer;
|
||||
import com.intellij.util.io.EnumeratorIntegerDescriptor;
|
||||
import com.intellij.util.io.IntInlineKeyDescriptor;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -49,7 +50,7 @@ public class OutputToTargetRegistry extends AbstractStateStorage<Integer, TIntHa
|
||||
};
|
||||
|
||||
OutputToTargetRegistry(File storePath) throws IOException {
|
||||
super(storePath, new IntInlineKeyDescriptor(), DATA_EXTERNALIZER);
|
||||
super(storePath, EnumeratorIntegerDescriptor.INSTANCE, DATA_EXTERNALIZER);
|
||||
}
|
||||
|
||||
protected void addMapping(String outputPath, int buildTargetId) throws IOException {
|
||||
|
||||
@@ -102,8 +102,6 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
|
||||
return builder != null && builder.acceptsFile(file);
|
||||
}
|
||||
|
||||
private static final KeyDescriptor<Integer> DATA_DESCRIPTOR = new IntInlineKeyDescriptor();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ID<Integer, SerializedStubTree> getName() {
|
||||
@@ -326,7 +324,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
|
||||
@NotNull
|
||||
@Override
|
||||
public KeyDescriptor<Integer> getKeyDescriptor() {
|
||||
return DATA_DESCRIPTOR;
|
||||
return EnumeratorIntegerDescriptor.INSTANCE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -65,7 +65,7 @@ public class VcsLogPathsIndex extends VcsLogFullDetailsIndex<List<VcsLogPathsInd
|
||||
@Override
|
||||
public PersistentHashMap<Integer, List<Collection<Integer>>> createMap() throws IOException {
|
||||
File storageFile = myStorageId.getStorageFile(myName + ".idx");
|
||||
return new PersistentHashMap<>(storageFile, new IntInlineKeyDescriptor(), new IntCollectionListExternalizer(), Page.PAGE_SIZE);
|
||||
return new PersistentHashMap<>(storageFile, EnumeratorIntegerDescriptor.INSTANCE, new IntCollectionListExternalizer(), Page.PAGE_SIZE);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ public class VcsLogPersistentIndex implements VcsLogModifiableIndex, Disposable
|
||||
Disposer.register(this, () -> catchAndWarn(commits::close));
|
||||
|
||||
File messagesStorage = new StorageId(INDEX, logId, VcsLogStorageImpl.VERSION + MESSAGES_VERSION).getStorageFile(MESSAGES);
|
||||
messages = new PersistentHashMap<>(messagesStorage, new IntInlineKeyDescriptor(), EnumeratorStringDescriptor.INSTANCE,
|
||||
messages = new PersistentHashMap<>(messagesStorage, EnumeratorIntegerDescriptor.INSTANCE, EnumeratorStringDescriptor.INSTANCE,
|
||||
Page.PAGE_SIZE);
|
||||
Disposer.register(this, () -> catchAndWarn(messages::close));
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class VcsLogUserIndex extends VcsLogFullDetailsIndex<Void, VcsFullCommitD
|
||||
@Override
|
||||
public PersistentHashMap<Integer, Collection<Integer>> createMap() throws IOException {
|
||||
File storageFile = myStorageId.getStorageFile(myName + ".idx");
|
||||
return new PersistentHashMap<>(storageFile, new IntInlineKeyDescriptor(), new IntCollectionDataExternalizer(), Page.PAGE_SIZE);
|
||||
return new PersistentHashMap<>(storageFile, EnumeratorIntegerDescriptor.INSTANCE, new IntCollectionDataExternalizer(), Page.PAGE_SIZE);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user