PsiClass[] () { PsiClass containingClass = member.getContainingClass(); final PsiExpression expression = ((PsiReferenceExpression)reference).getQualifierExpression(); PsiClass psiClass; if (reference instanceof PsiMethodReferenceExpression) { psiClass = PsiMethodReferenceUtil.getQualifierResolveResult((PsiMethodReferenceExpression)reference).getContainingClass(); } else if (expression != null) { psiClass = PsiUtil.resolveClassInType(expression.getType()); } else { if (member instanceof PsiClass) { psiClass = (PsiClass)member; final PsiElement resolve = ((PsiReferenceExpression)reference).advancedResolve(true).getElement(); if (resolve instanceof PsiClass) { containingClass = (PsiClass)resolve; } } else { psiClass = PsiTreeUtil.getParentOfType((PsiReferenceExpression)reference, PsiClass.class); } } if (containingClass == null && psiClass == null) return PsiClass.EMPTY_ARRAY; if (containingClass != null) { PsiClass[] inheritors = getInheritors(containingClass, psiClass, new HashSet<>()); return inheritors.length == 0 ? null : inheritors; } return null; }