private static void generateBody(@NotNull Project project, PsiCodeBlock block, ProgressIndicator indicator) {
    indicator.setIndeterminate(false);
    PsiType returnType = PsiTypesUtil.getMethodReturnType(block);
    if (returnType == null) return;

    List<PsiReturnStatement> returns = Arrays.asList(PsiUtil.findReturnStatements(block));
    indicator.checkCanceled();
    indicator.setFraction(0.1);
    FinishMarker marker = FinishMarker.defineFinishMarker(block, returnType, returns);
    indicator.checkCanceled();
    indicator.setFraction(0.2);
    indicator.checkCanceled();
    indicator.setFraction(0.3);
    PsiLocalVariable variable = convertReturns(project, block, returnType, marker, returns.size(), indicator);
    if (variable != null) {
      PsiJavaToken end = Objects.requireNonNull(block.getRBrace());
      block.addBefore(JavaPsiFacade.getElementFactory(project).createStatementFromText("return " + variable.getName() + ";", block), end);
    }
  }
private static void generateBody(@NotNull Project project, PsiCodeBlock block, ProgressIndicator indicator)