private static boolean isCalledInRecursiveMethod(@NotNull UExpression getChildrenMethodCall) {
    UMethod containingMethod = UastUtils.getParentOfType(getChildrenMethodCall, UMethod.class);
    if (containingMethod == null) return false;
    String containingMethodName = containingMethod.getName();

    Ref<Boolean> isInRecursiveCall = Ref.create();
    PsiElement methodSourcePsi = containingMethod.getSourcePsi();
    if (methodSourcePsi == null) return false;
    methodSourcePsi.accept(new PsiRecursiveElementVisitor() {

      @Override
      public void visitElement(@NotNull PsiElement element) {
        super.visitElement(element);
        UCallExpression potentialRecursiveCall = UastContextKt.toUElement(element, UCallExpression.class);
        if (potentialRecursiveCall == null) return;
        if (!potentialRecursiveCall.isMethodNameOneOf(List.of(containingMethodName))) return;
        if (potentialRecursiveCall != getChildrenMethodCall && expressionResolvesToMethod(potentialRecursiveCall, containingMethod)) {
          isInRecursiveCall.set(Boolean.TRUE);
        }
      }

      private static boolean expressionResolvesToMethod(@NotNull UCallExpression potentialRecursiveCall, @NotNull UMethod uMethod) {
        PsiMethod resolvedMethod = potentialRecursiveCall.resolve();
        if (resolvedMethod == null) return false;
        UElement resolvedUMethod = UastContextKt.toUElement(resolvedMethod);
        if (resolvedUMethod == null) return false;
        return uMethod.getSourcePsi() == resolvedUMethod.getSourcePsi();
      }
    });
    return Boolean.TRUE == isInRecursiveCall.get();
  }
private static boolean isCalledInRecursiveMethod(@NotNull UExpression getChildrenMethodCall)