private static PsiTypeParameter[] collectTypeParams(PsiTypeParameter[] parameters, PsiType[] types) {
    Set<PsiTypeParameter> visited = new HashSet<>();
    collectTypeParams(parameters, visited, types);

    return visited.toArray(PsiTypeParameter.EMPTY_ARRAY);
  }
private static PsiTypeParameter[] collectTypeParams(PsiTypeParameter[] parameters, PsiType[] types)