@Override
  protected Object @NotNull [] buildChildren(@NotNull HierarchyNodeDescriptor descriptor) {
    PsiMember enclosingElement = ((CallHierarchyNodeDescriptor)descriptor).getEnclosingElement();
    if (!(enclosingElement instanceof PsiMethod method)) {
      return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
    }

    List<PsiMethod> methods = new ArrayList<>();

    PsiCodeBlock body = method.getBody();
    if (body != null) {
      collectCallees(body, methods);
    }

    PsiMethod baseMethod = (PsiMethod)((CallHierarchyNodeDescriptor)getBaseDescriptor()).getTargetElement();
    PsiClass baseClass = baseMethod.getContainingClass();

    Map<PsiMethod,CallHierarchyNodeDescriptor> methodToDescriptorMap = new HashMap<>();

    List<CallHierarchyNodeDescriptor> result = new ArrayList<>();

    // also add overriding methods as children
    Iterable<PsiMethod> methodsToAdd = ContainerUtil.concat(methods, OverridingMethodsSearch.search(method));
    for (PsiMethod callee : methodsToAdd) {
      if (!isInScope(baseClass, callee, myScopeType)
        || JavaCallReferenceProcessor.isRecursiveNode(callee, descriptor)) {
        continue;
      }

      CallHierarchyNodeDescriptor d = methodToDescriptorMap.get(callee);
      if (d == null) {
        d = new CallHierarchyNodeDescriptor(myProject, descriptor, callee, false, false);
        methodToDescriptorMap.put(callee, d);
        result.add(d);
      }
      else {
        d.incrementUsageCount();
      }
    }

    return ArrayUtil.toObjectArray(result);
  }
@Override
  protected Object @NotNull [] buildChildren(@NotNull HierarchyNodeDescriptor descriptor)