avoid concrete class IntOpenHashSet, use interface instead

GitOrigin-RevId: 592050b9a3bdc5a1d490f45efaae4ba0367de490
This commit is contained in:
Alexey Kudravtsev
2020-10-07 12:36:08 +02:00
committed by intellij-monorepo-bot
parent 49406bca9c
commit d4fbdcc1f2
13 changed files with 29 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import com.intellij.util.io.*;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -77,7 +78,7 @@ public final class TestModuleIndex {
@Override
public IntList read(@NotNull DataInput dataInput) throws IOException {
IntOpenHashSet result = new IntOpenHashSet();
IntSet result = new IntOpenHashSet();
while (((InputStream)dataInput).available() > 0) {
result.add(DataInputOutputUtil.readINT(dataInput));
}

View File

@@ -19,6 +19,7 @@ import com.intellij.util.IncorrectOperationException;
import com.intellij.util.ObjectUtils;
import com.siyeh.ig.psiutils.CommentTracker;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
@@ -108,7 +109,7 @@ public final class MoveParenthesisFix implements IntentionAction, HighPriorityAc
PsiExpression[] parentArgs = parent.getExpressions();
int pos = ArrayUtil.indexOf(parentArgs, callExpression);
if (pos == -1) return false;
IntOpenHashSet shifts = new IntOpenHashSet();
IntSet shifts = new IntOpenHashSet();
for (CandidateInfo candidate : candidates) {
PsiMethod candidateMethod = ObjectUtils.tryCast(candidate.getElement(), PsiMethod.class);
if (candidateMethod == null || candidateMethod.isVarArgs()) return false;

View File

@@ -8,6 +8,7 @@ import com.intellij.psi.CustomHighlighterTokenType;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.containers.CharTrie;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -23,7 +24,7 @@ public final class KeywordParser {
private static final Logger LOG = Logger.getInstance(KeywordParser.class);
private final List<Set<String>> myKeywordSets = new ArrayList<>();
private final CharTrie myTrie = new CharTrie();
private final IntOpenHashSet myHashCodes = new IntOpenHashSet();
private final IntSet myHashCodes = new IntOpenHashSet();
private final boolean myIgnoreCase;
public KeywordParser(List<Set<String>> keywordSets, boolean ignoreCase) {

View File

@@ -19,6 +19,7 @@ import com.intellij.lang.WhitespacesAndCommentsBinder;
import com.intellij.openapi.util.NlsContexts;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -36,7 +37,7 @@ final class MarkerOptionalData extends BitSet {
private final Int2ObjectOpenHashMap<@Nls String> myDoneErrors = new Int2ObjectOpenHashMap<>();
private final Int2ObjectOpenHashMap<WhitespacesAndCommentsBinder> myLeftBinders = new Int2ObjectOpenHashMap<>();
private final Int2ObjectOpenHashMap<WhitespacesAndCommentsBinder> myRightBinders = new Int2ObjectOpenHashMap<>();
private final IntOpenHashSet myCollapsed = new IntOpenHashSet();
private final IntSet myCollapsed = new IntOpenHashSet();
void clean(int markerId) {
if (get(markerId)) {

View File

@@ -4,6 +4,7 @@ package com.intellij.openapi.editor.impl;
import com.intellij.openapi.editor.impl.view.FontLayoutService;
import com.intellij.openapi.util.SystemInfo;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.intellij.lang.annotations.JdkConstants;
import org.jetbrains.annotations.NotNull;
import sun.font.CompositeGlyphMapper;
@@ -21,7 +22,7 @@ public final class FontInfo {
private final Font myFont;
private final int mySize;
@JdkConstants.FontStyle private final int myStyle;
private final IntOpenHashSet mySafeCharacters = new IntOpenHashSet();
private final IntSet mySafeCharacters = new IntOpenHashSet();
private final FontRenderContext myContext;
private FontMetrics myFontMetrics = null;

View File

@@ -407,7 +407,7 @@ public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
}
return cmp;
});
IntOpenHashSet prevChildren = new IntOpenHashSet(myData.myChildrenIds);
IntSet prevChildren = new IntOpenHashSet(myData.myChildrenIds);
VfsData vfsData = getVfsData();
for (int i = 0; i < children.size(); i++) {
ChildInfo child = children.get(i);

View File

@@ -2375,7 +2375,7 @@ public final class MVStore implements AutoCloseable {
Queue<Chunk> old = findOldChunks(writeLimit, targetFillRate);
int oldSize = old.size();
if (oldSize != 0) {
IntOpenHashSet idSet = new IntOpenHashSet(oldSize);
IntSet idSet = new IntOpenHashSet(oldSize);
for (Chunk c : old) {
idSet.add(c.id);
}

View File

@@ -8,6 +8,7 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.diff.Diff;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -19,7 +20,7 @@ import java.util.StringTokenizer;
public final class Util {
private static final Logger LOG = Logger.getInstance(Util.class);
private static final String DELIMITERS = " \n\r\t(){}[],./?`~!@#$%^&*-=+|\\;:'\"<>";
public static final IntOpenHashSet DELIMITERS_SET;
public static final IntSet DELIMITERS_SET;
static {
char[] delimiters = DELIMITERS.toCharArray();

View File

@@ -5,6 +5,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Function;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -129,7 +130,7 @@ public final class ParametersListUtil {
final StringBuilder token = new StringBuilder(128);
boolean inQuotes = false;
boolean escapedQuote = false;
IntOpenHashSet possibleQuoteChars = new IntOpenHashSet();
IntSet possibleQuoteChars = new IntOpenHashSet();
possibleQuoteChars.add('"');
if (supportSingleQuotes) {
possibleQuoteChars.add('\'');

View File

@@ -11,6 +11,7 @@ import com.intellij.vcs.log.graph.utils.UpdatableIntToIntMap;
import com.intellij.vcs.log.graph.utils.impl.ListIntToIntMap;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -95,8 +96,8 @@ public final class CollapsedGraph {
@NotNull private final EdgeStorageWrapper myEdgesToAdd = EdgeStorageWrapper.createSimpleEdgeStorage();
@NotNull private final EdgeStorageWrapper myEdgesToRemove = EdgeStorageWrapper.createSimpleEdgeStorage();
@NotNull private final IntOpenHashSet myNodesToHide = new IntOpenHashSet();
@NotNull private final IntOpenHashSet myNodesToShow = new IntOpenHashSet();
@NotNull private final IntSet myNodesToHide = new IntOpenHashSet();
@NotNull private final IntSet myNodesToShow = new IntOpenHashSet();
private boolean myClearEdges = false;
private boolean myClearVisibility = false;

View File

@@ -19,6 +19,7 @@ import com.intellij.vcs.log.graph.linearBek.LinearBekController;
import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -169,7 +170,7 @@ public final class PermanentGraphImpl<CommitId> implements PermanentGraph<Commit
public Condition<CommitId> getContainedInBranchCondition(@NotNull final Collection<? extends CommitId> heads) {
List<Integer> headIds = ContainerUtil.map(heads, head -> myPermanentCommitsInfo.getNodeId(head));
if (!heads.isEmpty() && ContainerUtil.getFirstItem(heads) instanceof Integer) {
final IntOpenHashSet branchNodes = new IntOpenHashSet();
IntSet branchNodes = new IntOpenHashSet();
myReachableNodes.walkDown(headIds, node -> branchNodes.add(((Integer)myPermanentCommitsInfo.getCommitId(node)).intValue()));
return new IntContainedInBranchCondition<>(branchNodes);
}
@@ -221,9 +222,9 @@ public final class PermanentGraphImpl<CommitId> implements PermanentGraph<Commit
}
private static class IntContainedInBranchCondition<CommitId> implements Condition<CommitId> {
private final IntOpenHashSet myBranchNodes;
private final IntSet myBranchNodes;
IntContainedInBranchCondition(IntOpenHashSet branchNodes) {
IntContainedInBranchCondition(IntSet branchNodes) {
myBranchNodes = branchNodes;
}

View File

@@ -12,6 +12,7 @@ import com.intellij.vcs.log.graph.utils.IntIntMultiMap;
import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -181,8 +182,8 @@ final class LinearBekGraphBuilder {
private boolean myMergeWithOldCommit = false;
@NotNull private final IntIntMultiMap myTailEdges = new IntIntMultiMap();
@NotNull private final IntOpenHashSet myBlockBody = new IntOpenHashSet();
@NotNull private final IntOpenHashSet myTails = new IntOpenHashSet();
@NotNull private final IntSet myBlockBody = new IntOpenHashSet();
@NotNull private final IntSet myTails = new IntOpenHashSet();
private MergeFragment(int parent, int leftChild, int rightChild) {
myParent = parent;
@@ -216,7 +217,7 @@ final class LinearBekGraphBuilder {
}
@NotNull
public IntOpenHashSet getTails() {
public IntSet getTails() {
return myTails;
}

View File

@@ -44,6 +44,7 @@ import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.impl.XSourcePositionImpl;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -152,7 +153,7 @@ public final class XLineBreakpointManager {
return;
}
IntOpenHashSet lines = new IntOpenHashSet();
IntSet lines = new IntOpenHashSet();
List<XLineBreakpoint> toRemove = new SmartList<>();
for (XLineBreakpointImpl breakpoint : breakpoints) {
breakpoint.updatePosition();