public static boolean isMainMethodWithProvider(@NotNull PsiClass psiClass, @NotNull PsiElement psiElement) {
    JavaMainMethodProvider mainMethodProvider = getApplicableMainMethodProvider(psiClass);
    if (mainMethodProvider != null) {
      return mainMethodProvider.isMain(psiElement);
    }

    DumbService dumbService = DumbService.getInstance(psiElement.getProject());
    try {
      return dumbService.computeWithAlternativeResolveEnabled((ThrowableComputable<Boolean, Throwable>)() -> {
        PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiElement, PsiMethod.class);
        if (psiMethod == null) return false;

        return "main".equals(psiMethod.getName()) && isMainMethod(psiMethod);
      });
    }
    catch (IndexNotReadyException e) {
      return false;
    }
  }
public static boolean isMainMethodWithProvider(@NotNull PsiClass psiClass, @NotNull PsiElement psiElement)