@Override
  public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement expression) {
    if (!referencesStaticallyAccessible) {
      return;
    }

    super.visitReferenceElement(expression);
    if (expression.isQualified()) {
      return;
    }
    final PsiElement target = expression.resolve();
    if (target instanceof PsiLocalVariable || target instanceof PsiParameter) {
      return;
    }
    if (target instanceof PsiMethod || target instanceof PsiField) {
      final PsiMember member = (PsiMember)target;
      if (member.hasModifierProperty(PsiModifier.STATIC) || PsiTreeUtil.isAncestor(innerClass, member, true)) {
        return;
      }
      if (!member.hasModifierProperty(PsiModifier.PRIVATE)) {
        final PsiClass containingClass = member.getContainingClass();
        if (InheritanceUtil.isInheritorOrSelf(innerClass, containingClass, true)) {
          return;
        }

        PsiClass parentClass = PsiTreeUtil.getParentOfType(expression, PsiClass.class);
        while (parentClass != null && PsiTreeUtil.isAncestor(innerClass, parentClass, true)) {
          if (InheritanceUtil.isInheritorOrSelf(parentClass, containingClass, true)) {
            return;
          }
          parentClass = PsiTreeUtil.getParentOfType(parentClass, PsiClass.class, true);
        }
      }
      referencesStaticallyAccessible = false;
    }
    else if (target instanceof PsiClass && !isClassStaticallyAccessible((PsiClass)target)) {
      referencesStaticallyAccessible = false;
    }
  }
@Override
  public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement expression)