mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
performance optimizations for lookup with many items:
- avoid expensive Class#isInstanceOf of LookupElement sublcasses #as using specialized <SpecificLookupItem> #from with explicit instanceof SpecificLookupItem - using identity hashing for binding lookup item weights to item
This commit is contained in:
@@ -784,7 +784,7 @@ public class JavaCompletionUtil {
|
||||
|
||||
@Nullable
|
||||
public static PsiType getLookupElementType(final LookupElement element) {
|
||||
final TypedLookupItem typed = element.as(TypedLookupItem.class);
|
||||
TypedLookupItem typed = typedFrom(element);
|
||||
if (typed != null) {
|
||||
return typed.getType();
|
||||
}
|
||||
@@ -805,6 +805,16 @@ public class JavaCompletionUtil {
|
||||
return qualifierType;
|
||||
}
|
||||
|
||||
public static @Nullable TypedLookupItem typedFrom(LookupElement element) {
|
||||
TypedLookupItem typed = null;
|
||||
if (element instanceof TypedLookupItem) typed = (TypedLookupItem)element;
|
||||
else if (element instanceof LookupElementDecorator) {
|
||||
element = ((LookupElementDecorator)element).getDelegate();
|
||||
if (element instanceof TypedLookupItem) typed = (TypedLookupItem)element;
|
||||
}
|
||||
return typed;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiType getQualifiedMemberReferenceType(@Nullable PsiType qualifierType, @NotNull final PsiMember member) {
|
||||
final ClassCandidateInfo info = TypeConversionUtil.splitType(qualifierType, member);
|
||||
|
||||
Reference in New Issue
Block a user