mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
avoid using int-object maps from "fastutil" library in api modules
GitOrigin-RevId: d07e123190c4e6f72f9a5c522f2f6e023e640321
This commit is contained in:
committed by
intellij-monorepo-bot
parent
febc631750
commit
ca1f84752b
@@ -7,8 +7,8 @@ import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import com.intellij.util.containers.ObjectIntHashMap;
|
||||
import com.intellij.util.containers.ObjectIntMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -71,9 +71,9 @@ public final class ClassUtil {
|
||||
}
|
||||
|
||||
private static int getNonQualifiedClassIdx(@NotNull final PsiClass psiClass, @NotNull final PsiClass containingClass) {
|
||||
Object2IntMap<PsiClass> indices =
|
||||
ObjectIntMap<PsiClass> indices =
|
||||
CachedValuesManager.getCachedValue(containingClass, () -> {
|
||||
Object2IntMap<PsiClass> map = new Object2IntOpenHashMap<>();
|
||||
ObjectIntMap<PsiClass> map = new ObjectIntHashMap<>();
|
||||
int index = 0;
|
||||
for (PsiClass aClass : SyntaxTraverser.psiTraverser().withRoot(containingClass).postOrderDfsTraversal().filter(PsiClass.class)) {
|
||||
if (aClass.getQualifiedName() == null) {
|
||||
@@ -83,7 +83,7 @@ public final class ClassUtil {
|
||||
return CachedValueProvider.Result.create(map, containingClass);
|
||||
});
|
||||
|
||||
return indices.getInt(psiClass);
|
||||
return indices.get(psiClass);
|
||||
}
|
||||
|
||||
public static PsiClass findNonQualifiedClassByIndex(@NotNull String indexName,
|
||||
|
||||
@@ -13,8 +13,8 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import com.intellij.util.containers.ObjectIntHashMap;
|
||||
import com.intellij.util.containers.ObjectIntMap;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,7 +37,7 @@ public final class TypeConversionUtil {
|
||||
{false, false, false, false, false, false, true}, // double
|
||||
};
|
||||
|
||||
private static final Object2IntMap<PsiType> TYPE_TO_RANK_MAP = new Object2IntOpenHashMap<>();
|
||||
private static final ObjectIntMap<PsiType> TYPE_TO_RANK_MAP = new ObjectIntHashMap<>();
|
||||
|
||||
@MagicConstant(intValues = {BYTE_RANK, SHORT_RANK, CHAR_RANK, INT_RANK, FLOAT_RANK, DOUBLE_RANK, BOOL_RANK, STRING_RANK, UNKNOWN_RANK})
|
||||
@interface TypeRank {
|
||||
@@ -586,8 +586,8 @@ public final class TypeConversionUtil {
|
||||
type = unboxedType;
|
||||
}
|
||||
|
||||
int rank = TYPE_TO_RANK_MAP.getInt(type);
|
||||
if (rank != 0) {
|
||||
int rank = TYPE_TO_RANK_MAP.get(type);
|
||||
if (rank != -1) {
|
||||
return rank;
|
||||
}
|
||||
if (type.equalsToText(JAVA_LANG_STRING)) {
|
||||
@@ -939,8 +939,10 @@ public final class TypeConversionUtil {
|
||||
if (!(left instanceof PsiPrimitiveType)) {
|
||||
return left instanceof PsiClassType && isBoxable((PsiClassType)left, (PsiPrimitiveType)right);
|
||||
}
|
||||
int leftTypeIndex = TYPE_TO_RANK_MAP.getInt(left) - 1;
|
||||
int rightTypeIndex = TYPE_TO_RANK_MAP.getInt(right) - 1;
|
||||
int l = TYPE_TO_RANK_MAP.get(left);
|
||||
int r = TYPE_TO_RANK_MAP.get(right);
|
||||
int leftTypeIndex = (l==-1?0:l) - 1;
|
||||
int rightTypeIndex = (r==-1?0:r) - 1;
|
||||
return leftTypeIndex >= 0 &&
|
||||
rightTypeIndex >= 0 &&
|
||||
rightTypeIndex < IS_ASSIGNABLE_BIT_SET.length &&
|
||||
@@ -1616,10 +1618,10 @@ public final class TypeConversionUtil {
|
||||
if (target == null || source == null) return false;
|
||||
if (target.equals(source)) return true;
|
||||
|
||||
int sourceRank = TYPE_TO_RANK_MAP.getInt(source);
|
||||
int targetRank = TYPE_TO_RANK_MAP.getInt(target);
|
||||
if (sourceRank == 0 || sourceRank > MAX_NUMERIC_RANK ||
|
||||
targetRank == 0 || targetRank > MAX_NUMERIC_RANK ||
|
||||
int sourceRank = TYPE_TO_RANK_MAP.get(source);
|
||||
int targetRank = TYPE_TO_RANK_MAP.get(target);
|
||||
if (sourceRank == -1 || sourceRank > MAX_NUMERIC_RANK ||
|
||||
targetRank == -1 || targetRank > MAX_NUMERIC_RANK ||
|
||||
!IS_ASSIGNABLE_BIT_SET[sourceRank-1][targetRank-1]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user