boolean (@NotNull PsiClass containingClass, PsiElement element) { if (element instanceof PsiThisExpression) { return PsiUtil.resolveClassInType(((PsiThisExpression)element).getType()) == containingClass; } if (element instanceof PsiReferenceExpression) { PsiReferenceExpression qualifierReference = tryCast(((PsiReferenceExpression)element).getQualifierExpression(), PsiReferenceExpression.class); if (qualifierReference != null) return false; PsiMember member = tryCast(((PsiReferenceExpression)element).resolve(), PsiMember.class); return memberBringsThisRef(containingClass, member); } return false; }