mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
memory: intern frequent type text in cls references
This commit is contained in:
@@ -65,8 +65,10 @@ public class TypeInfo {
|
||||
"null",
|
||||
"short",
|
||||
"void",
|
||||
CommonClassNames.JAVA_LANG_OBJECT_SHORT, CommonClassNames.JAVA_LANG_OBJECT,
|
||||
CommonClassNames.JAVA_LANG_STRING_SHORT, CommonClassNames.JAVA_LANG_STRING
|
||||
CommonClassNames.JAVA_LANG_OBJECT_SHORT,
|
||||
CommonClassNames.JAVA_LANG_OBJECT,
|
||||
CommonClassNames.JAVA_LANG_STRING_SHORT,
|
||||
CommonClassNames.JAVA_LANG_STRING
|
||||
};
|
||||
|
||||
ourFrequentTypeIndex = new TObjectIntHashMap<String>();
|
||||
@@ -273,11 +275,11 @@ public class TypeInfo {
|
||||
buf.append("...");
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
return internFrequentType(buf.toString());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String internFrequentType(@NotNull String type) {
|
||||
public static String internFrequentType(@NotNull String type) {
|
||||
int frequentIndex = ourFrequentTypeIndex.get(type);
|
||||
return frequentIndex == 0 ? type : ourIndexFrequentType[frequentIndex];
|
||||
}
|
||||
|
||||
+5
-2
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiSubstitutorImpl;
|
||||
import com.intellij.psi.impl.cache.TypeInfo;
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
@@ -45,8 +46,10 @@ public class ClsJavaCodeReferenceElementImpl extends ClsElementImpl implements P
|
||||
public ClsJavaCodeReferenceElementImpl(PsiElement parent, String canonicalText) {
|
||||
myParent = parent;
|
||||
|
||||
myCanonicalText = canonicalText;
|
||||
myQualifiedName = PsiNameHelper.getQualifiedClassName(myCanonicalText, false);
|
||||
String canonical = TypeInfo.internFrequentType(canonicalText);
|
||||
myCanonicalText = canonical;
|
||||
String qName = TypeInfo.internFrequentType(PsiNameHelper.getQualifiedClassName(myCanonicalText, false));
|
||||
myQualifiedName = qName.equals(canonical) ? canonical : qName;
|
||||
|
||||
String[] classParameters = PsiNameHelper.getClassParametersText(canonicalText);
|
||||
myRefParameterList = classParameters.length == 0 ? null : new ClsReferenceParameterListImpl(this, classParameters);
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.cache.TypeInfo;
|
||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
@@ -40,7 +41,7 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
|
||||
|
||||
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
|
||||
myParent = parent;
|
||||
myTypeText = typeText;
|
||||
myTypeText = TypeInfo.internFrequentType(typeText);
|
||||
myVariance = variance;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user