@Override
    public void visitClass(@NotNull PsiClass aClass) {
      super.visitClass(aClass);
      if (aClass.isEnum()) {
        return;
      }
      if (!UtilityClassUtil.isUtilityClass(aClass, true, true) || !UtilityClassUtil.hasPrivateEmptyOrNoConstructor(aClass)) {
        return;
      }
      LocalSearchScope scope = null;
      for (PsiField field : aClass.getFields()) {
        if (!field.hasModifierProperty(PsiModifier.FINAL) || !PsiUtil.isCompileTimeConstant(field)) {
          if (scope == null) {
            scope = new LocalSearchScope(new PsiElement[]{aClass}, null, true);
          }
          // It's a compile error when non-constant is accessed from initializer or constructor in an enum
          for (PsiReference reference : ReferencesSearch.search(field, scope)) {
            // no need to check constructors, or instance field, because utility classes only have empty constructors and static fields
            final PsiClassInitializer initializer =
              PsiTreeUtil.getParentOfType(reference.getElement(), PsiClassInitializer.class, true, PsiClass.class);
            if (initializer != null && !initializer.hasModifierProperty(PsiModifier.STATIC)) {
              return;
            }
          }
        }
      }
      for (PsiReference reference : ReferencesSearch.search(aClass)) {
        if (reference.getElement().getParent() instanceof PsiNewExpression) {
          return;
        }
      }
      registerClassError(aClass);
    }
@Override
    public void visitClass(@NotNull PsiClass aClass)