PsiClass (final PsiMember member, final PsiExpression exprQualifier, final PsiExpression expression) { if (exprQualifier != null) { final PsiType type = exprQualifier.getType(); if (type instanceof PsiClassType) { return ((PsiClassType)type).resolve(); } return null; } else { PsiClass referencedClass = member.getContainingClass(); if (referencedClass == null) return null; final PsiClass parentClass = PsiTreeUtil.getParentOfType(expression, PsiClass.class); assert parentClass != null; if (InheritanceUtil.isInheritorOrSelf(parentClass, referencedClass, false)) { referencedClass = parentClass; } return referencedClass; } }