@Override
  public CommonProblemDescriptor @Nullable [] checkElement(@NotNull RefEntity refEntity,
                                                           @NotNull AnalysisScope scope,
                                                           @NotNull InspectionManager manager,
                                                           @NotNull GlobalInspectionContext globalContext) {
    if (!(refEntity instanceof RefMethod) && !(refEntity instanceof RefField)) {
      return null;
    }
    final RefJavaElement element = (RefJavaElement)refEntity;
    if (!element.isStatic() || PsiModifier.PRIVATE.equals(element.getAccessModifier())) {
      return null;
    }
    RefClass usageClass = null;
    for (RefElement reference : element.getInReferences()) {
      final RefClass ownerClass = getOwnerClass(reference);
      if (usageClass == null) {
        usageClass = ownerClass;
      }
      else if (usageClass != ownerClass) {
        return null;
      }
    }
    final RefClass containingClass = element instanceof RefMethod
                                     ? ((RefMethod)element).getOwnerClass()
                                     : ((RefField)element).getOwnerClass();
    if (containingClass == null || usageClass == containingClass) {
      return null;
    }
    if (usageClass == null) {
      final PsiClass aClass = ObjectUtils.tryCast(containingClass.getPsiElement(), PsiClass.class);
      if (aClass != null) {
        final SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(manager.getProject());
        element.putUserData(MARKER, smartPointerManager.createSmartPsiElementPointer(aClass));
      }
      return null;
    }
    if (ignoreAnonymousClasses && (usageClass.isAnonymous() || usageClass.isLocalClass() ||
                                   usageClass.getOwner() instanceof RefClass && !usageClass.isStatic())) {
      return null;
    }
    if (ignoreTestClasses && usageClass.isTestCase()) {
      return null;
    }
    if (ignoreUtilityClasses && containingClass.isUtilityClass()) {
      // RefClass.isUtilityClass() is also true for enums
      return null;
    }
    final PsiClass psiClass = ObjectUtils.tryCast(usageClass.getPsiElement(), PsiClass.class);
    if (psiClass == null) {
      return null;
    }
    if (element instanceof RefMethod) {
      final PsiMethod method = ObjectUtils.tryCast(element.getPsiElement(), PsiMethod.class);
      if (method == null || MethodUtils.isFactoryMethod(method) || MethodUtils.isConvenienceOverload(method)) {
        return null;
      }
      if (ignoreOnConflicts) {
        if (psiClass.findMethodsBySignature(method, true).length > 0 || !areReferenceTargetsAccessible(method, psiClass)) {
          return null;
        }
      }
      final SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(manager.getProject());
      element.putUserData(MARKER, smartPointerManager.createSmartPsiElementPointer(psiClass));
      return new ProblemDescriptor[]{createProblemDescriptor(manager, method.getNameIdentifier(), psiClass)};
    }
    else {
      final RefField refField = (RefField)element;
      if (refField.isEnumConstant()) {
        return null;
      }
      final PsiField field = ObjectUtils.tryCast(element.getPsiElement(), PsiField.class);
      if (field == null || isSingletonField(field)) {
        return null;
      }
      if (ignoreOnConflicts) {
        if (psiClass.findFieldByName(element.getName(), true) != null || !areReferenceTargetsAccessible(field, psiClass)) {
          return null;
        }
      }
      final SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(manager.getProject());
      element.putUserData(MARKER, smartPointerManager.createSmartPsiElementPointer(psiClass));
      return new ProblemDescriptor[]{createProblemDescriptor(manager, field.getNameIdentifier(), psiClass)};
    }
  }
@Override
  public CommonProblemDescriptor @Nullable [] checkElement(@NotNull RefEntity refEntity,
                                                           @NotNull AnalysisScope scope,
                                                           @NotNull InspectionManager manager,
                                                           @NotNull GlobalInspectionContext globalContext)