static Block find(@NotNull PsiElement start, int maxSize) {
      final List<PsiStatement> statements = new ArrayList<>(maxSize);
      final List<PsiComment> comments = new ArrayList<>();
      while (statements.size() < maxSize && (start = start.getPrevSibling()) != null) {
        if (start instanceof PsiStatement statement) {
          if (statements.isEmpty() && statement instanceof PsiBlockStatement block) {
            return new Block(block);
          }
          else {
            statements.add(statement);
          }
        }
        else if (!statements.isEmpty() && start instanceof PsiComment comment) { // ignore comments between while and duplicate code
          comments.add(comment);
        }
      }
      Collections.reverse(statements);
      Collections.reverse(comments);
      return new Block(statements, comments);
    }
static Block find(@NotNull PsiElement start, int maxSize)