private static void clearUsedParameters(@NotNull RefOverridable refOverridable, RefParameter[] params, boolean checkDeep) {
    RefParameter[] methodParams;
    if (refOverridable instanceof RefMethod) {
      methodParams = ((RefMethod)refOverridable).getParameters();
    }
    else if (refOverridable instanceof RefFunctionalExpression) {
      methodParams = ((RefFunctionalExpression)refOverridable).getParameters().toArray(RefParameter[]::new);
    }
    else {
      return;
    }

    for (int i = 0; i < Math.min(methodParams.length, params.length); i++) {
      if (methodParams[i].isUsedForReading()) params[i] = null;
    }

    if (checkDeep) {
      for (RefOverridable reference : refOverridable.getDerivedReferences()) {
        clearUsedParameters(reference, params, true);
      }
    }
  }
private static void clearUsedParameters(@NotNull RefOverridable refOverridable, RefParameter[] params, boolean checkDeep)