public static boolean isMethodUsed(@NotNull Project project,
                                     @NotNull PsiFile containingFile,
                                     @NotNull PsiMethod method,
                                     @NotNull GlobalUsageHelper helper) {
    if (helper.isLocallyUsed(method)) return true;

    PsiClass containingClass = method.getContainingClass();
    if ("value".equals(method.getName()) && 
        method.getReturnType() instanceof PsiArrayType && 
        containingClass != null && 
        containingClass.isAnnotationType() &&
        isClassUsed(project, containingFile, containingClass, helper)) {
      // conservative @Repeatable container annotation check
      // consider value() method with array return type used, when the containing @interface is used
      return true;
    }
    boolean isPrivate = method.hasModifierProperty(PsiModifier.PRIVATE);
    if (JavaHighlightUtil.isSerializationRelatedMethod(method, containingClass)) return true;
    if (isPrivate) {
      if (isIntentionalPrivateConstructor(method, containingClass)) {
        return true;
      }
      if (isImplicitUsage(project, method)) {
        return true;
      }
      if (!helper.isCurrentFileAlreadyChecked()) {
        return !weAreSureThereAreNoUsages(project, containingFile, method, helper);
      }
    }
    else {
      //class maybe used in some weird way, e.g. from XML, therefore the only constructor is used too
      if (isTheOnlyConstructor(method, containingClass) &&
          isClassUsed(project, containingFile, containingClass, helper)) {
        return true;
      }
      if (isImplicitUsage(project, method)) return true;

      if (!method.isConstructor() && FindSuperElementsHelper.findSuperElements(method).length != 0) {
        return true;
      }
      return !weAreSureThereAreNoUsages(project, containingFile, method, helper);
    }
    return false;
  }
public static boolean isMethodUsed(@NotNull Project project,
                                     @NotNull PsiFile containingFile,
                                     @NotNull PsiMethod method,
                                     @NotNull GlobalUsageHelper helper)