Light Classes: Fix equivalence check

Do not consider PsiClass equiavent to KtLightClass
if it's not a light class as well

 #KT-16180 Fixed
This commit is contained in:
Alexey Sedunov
2017-04-17 17:50:50 +03:00
parent e6f1a3ccf3
commit 0c2ea5d799
2 changed files with 3 additions and 3 deletions
@@ -200,7 +200,7 @@ class KtLightClassForFacade private constructor(
override fun getNavigationElement() = files.iterator().next()
override fun isEquivalentTo(another: PsiElement?): Boolean {
return another is PsiClass && Comparing.equal(another.qualifiedName, qualifiedName)
return another is KtLightClassForFacade && Comparing.equal(another.qualifiedName, qualifiedName)
}
override fun getElementIcon(flags: Int): Icon? = throw UnsupportedOperationException("This should be done by JetIconProvider")
@@ -138,7 +138,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
override fun getNavigationElement(): PsiElement = classOrObject
override fun isEquivalentTo(another: PsiElement?): Boolean {
return another is PsiClass && Comparing.equal(another.qualifiedName, qualifiedName)
return another is KtLightClassForSourceDeclaration && Comparing.equal(another.qualifiedName, qualifiedName)
}
override fun getElementIcon(flags: Int): Icon? {
@@ -506,4 +506,4 @@ fun KtClassOrObject.defaultJavaAncestorQualifiedName(): String? {
isInterface() -> CommonClassNames.JAVA_LANG_OBJECT // see com.intellij.psi.impl.PsiClassImplUtil.getSuperClass
else -> CommonClassNames.JAVA_LANG_OBJECT
}
}
}