@NotNull
  public static PsiType captureToplevelWildcards(@NotNull PsiType type, @NotNull PsiElement context) {
    if (!(type instanceof PsiClassType)) return type;
    PsiClassType.ClassResolveResult result = ((PsiClassType)type).resolveGenerics();
    PsiClass aClass = result.getElement();
    if (aClass == null) return type;
    PsiClassType updatedType = getSubstitutorWithWildcardsCaptured(context, result);
    return updatedType == null ? type : updatedType;
  }
@NotNull
  public static PsiType captureToplevelWildcards(@NotNull PsiType type, @NotNull PsiElement context)