Fast implementation for KtLightClassForExplicitDeclaration#getContainingClass()
Prevent computing stubs for light classes for nested/inner classes when calling completion from java
This commit is contained in:
+6
@@ -47,6 +47,12 @@ class KtLightClassForAnonymousDeclaration extends KtLightClassForExplicitDeclara
|
||||
return JavaPsiFacade.getElementFactory(getClassOrObject().getProject()).createReferenceElementByType(getBaseClassType());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiClass getContainingClass() {
|
||||
return getDelegate().getContainingClass();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getFirstSupertypeFQName() {
|
||||
ClassDescriptor descriptor = getDescriptor();
|
||||
|
||||
+7
@@ -230,6 +230,13 @@ public open class KtLightClassForExplicitDeclaration(
|
||||
|
||||
override fun getContainingClass(): PsiClass? {
|
||||
if (classOrObject.parent === classOrObject.containingFile) return null
|
||||
|
||||
val containingClassOrObject = (classOrObject.parent as? KtClassBody)?.parent as? KtClassOrObject
|
||||
if (containingClassOrObject != null) {
|
||||
return create(containingClassOrObject)
|
||||
}
|
||||
|
||||
// TODO: should return null
|
||||
return super.getContainingClass()
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -46,4 +46,6 @@ public open class KtLightClassForInterfaceDefaultImpls(
|
||||
override fun setName(name: String): PsiElement {
|
||||
throw IncorrectOperationException("Impossible to rename DefaultImpls")
|
||||
}
|
||||
|
||||
override fun getContainingClass() = KtLightClassForExplicitDeclaration.create(classOrObject)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user