private static boolean hasInheritors(final PsiClass element) {
    final Collection<PsiElement> inheritors = new ArrayList<>();
    if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> {
      final PsiClass inheritor = ClassInheritorsSearch.search(element).findFirst();
      if (inheritor != null) {
        inheritors.add(inheritor);
      } else {
        final PsiFunctionalExpression functionalExpression = FunctionalExpressionSearch.search(element).findFirst();
        if (functionalExpression != null) {
          inheritors.add(functionalExpression);
        }
      }
    }), JavaRefactoringBundle.message("inline.anonymous.conflict.progress", element.getQualifiedName()), true, element.getProject())) return false;
    return !inheritors.isEmpty();
  }
private static boolean hasInheritors(final PsiClass element)