private static PsiElement @NotNull [] getParameterElementsToSearch(@NotNull PsiParameter parameter, @NotNull PsiMethod method) {
    PsiMethod[] overrides = OverridingMethodsSearch.search(method).toArray(PsiMethod.EMPTY_ARRAY);
    for (int i = 0; i < overrides.length; i++) {
      final PsiElement navigationElement = ReadAction.compute(overrides[i]::getNavigationElement);
      if (navigationElement instanceof PsiMethod) {
        overrides[i] = (PsiMethod)navigationElement;
      }
    }
    List<PsiElement> elementsToSearch = new ArrayList<>(overrides.length + 1);
    elementsToSearch.add(parameter);
    int idx = ReadAction.compute(() -> method.getParameterList().getParameterIndex(parameter));
    for (PsiMethod override : overrides) {
      final PsiParameter[] parameters = ReadAction.compute(() -> override.getParameterList().getParameters());
      if (idx < parameters.length) {
        elementsToSearch.add(parameters[idx]);
      }
    }

    FunctionalExpressionSearch.search(method).forEach(element -> {
      if (element instanceof PsiLambdaExpression) {
        PsiParameter[] parameters = ReadAction.compute(() -> ((PsiLambdaExpression)element).getParameterList().getParameters());
        if (idx < parameters.length) {
          elementsToSearch.add(parameters[idx]);
        }
      }
    });

    return PsiUtilCore.toPsiElementArray(elementsToSearch);
  }
private static PsiElement @NotNull [] getParameterElementsToSearch(@NotNull PsiParameter parameter, @NotNull PsiMethod method)