boolean (@NotNull PsiElement element, PsiClass memberClass) { PsiExpression qualifier = getQualifier(element); if (qualifier == null) { PsiClass enclosingInstance = InheritanceUtil.findEnclosingInstanceInScope(memberClass, element, Conditions.alwaysTrue(), true); return enclosingInstance != null && enclosingInstance != memberClass; } PsiClass qClass = PsiUtil.resolveClassInClassTypeOnly(qualifier.getType()); return qClass != null && qClass.isInheritor(memberClass, true); }