private void checkAccessStaticMemberViaInstanceReference(PsiReferenceExpression expr, ProblemsHolder holder) {
    JavaResolveResult result = expr.advancedResolve(false);
    PsiElement resolved = result.getElement();

    if (!(resolved instanceof PsiMember member)) return;
    PsiExpression qualifierExpression = expr.getQualifierExpression();
    if (qualifierExpression == null) return;

    if (qualifierExpression instanceof PsiReferenceExpression) {
      final PsiElement qualifierResolved = ((PsiReferenceExpression)qualifierExpression).resolve();
      if (qualifierResolved instanceof PsiClass || qualifierResolved instanceof PsiPackage) {
        return;
      }
    }
    if (!member.hasModifierProperty(PsiModifier.STATIC)) return;

    //don't report warnings on compilation errors
    PsiClass containingClass = member.getContainingClass();
    if (containingClass != null && containingClass.isInterface() && member instanceof PsiMethod) return;
    if (containingClass instanceof PsiAnonymousClass || containingClass instanceof PsiImplicitClass) return;

    String description = JavaErrorBundle.message("static.member.accessed.via.instance.reference",
                                                 JavaHighlightUtil.formatType(qualifierExpression.getType()),
                                                 HighlightMessageUtil.getSymbolName(resolved, result.getSubstitutor()));
    holder.registerProblem(expr, description, createAccessStaticViaInstanceFix(expr, result));
  }
private void checkAccessStaticMemberViaInstanceReference(PsiReferenceExpression expr, ProblemsHolder holder)