private static void collectTypeParams(PsiTypeParameter[] parameters,
                                        Set<PsiTypeParameter> visited,
                                        PsiType... type) {
    PsiTypeParameter[] typeParameters = PsiTypesUtil.filterUnusedTypeParameters(parameters, type);
    for (PsiTypeParameter parameter : typeParameters) {
      if (visited.add(parameter)) {
        collectTypeParams(parameters, visited, parameter.getExtendsListTypes());
      }
    }
  }
private static void collectTypeParams(PsiTypeParameter[] parameters,
                                        Set<PsiTypeParameter> visited,
                                        PsiType... type)