private static boolean isThisQualifierPossible(PsiExpression memberAccessExpression, @NotNull PsiMember member) {
    if (member.hasModifierProperty(PsiModifier.STATIC)) {
      return false;
    }
    final PsiClass memberClass = member.getContainingClass();
    if (memberClass == null) {
      return false;
    }
    PsiClass containingClass = PsiUtil.getContainingClass(memberAccessExpression);
    if (InheritanceUtil.isInheritorOrSelf(containingClass, memberClass, true)) {
      // unqualified this.
      return true;
    }
    do {
      containingClass = PsiUtil.getContainingClass(containingClass);
    }
    while (containingClass != null && !InheritanceUtil.isInheritorOrSelf(containingClass, memberClass, true));
    // qualified this needed, which is not possible on anonymous class.
    return containingClass != null && !(containingClass instanceof PsiAnonymousClass);
  }
private static boolean isThisQualifierPossible(PsiExpression memberAccessExpression, @NotNull PsiMember member)