@Nullable
  static JoiningTerminal extractTerminal(@NotNull TerminalBlock terminalBlock,
                                         @Nullable("when fix applied") List<PsiVariable> nonFinalVariables) {
    List<BiFunction<TerminalBlock, List<PsiVariable>, JoiningTerminal>> extractors = Arrays.asList(
      JoiningTerminal.CountedLoopJoiningTerminal::extractCountedLoopTerminal,
      JoiningTerminal.PlainJoiningTerminal::extractPlainJoining,
      JoiningTerminal.LengthBasedJoiningTerminal::extractLengthBasedTerminal,
      JoiningTerminal.BoolFlagJoiningTerminal::extractBoolFlagTerminal,
      JoiningTerminal.LengthTruncateJoiningTerminal::extractLengthTruncateTerminal,
      JoiningTerminal.DelimiterRewriteJoiningTerminal::extractDelimiterRewritingTerminal,
      JoiningTerminal.IndexBasedJoiningTerminal::extractIndexBasedTerminal
    );
    return StreamEx.of(extractors)
      .map(extractor -> extractor.apply(terminalBlock, nonFinalVariables))
      .nonNull()
      .findFirst()
      .orElse(null);
  }
@Nullable
  static JoiningTerminal extractTerminal(@NotNull TerminalBlock terminalBlock,
                                         @Nullable("when fix applied") List<PsiVariable> nonFinalVariables)