@NotNull
  public static PsiType createSetType(@NotNull PsiElement context, @NotNull PsiType type) {
    JavaPsiFacade facade = JavaPsiFacade.getInstance(context.getProject());
    GlobalSearchScope resolveScope = context.getResolveScope();

    PsiClass setClass = facade.findClass(JAVA_UTIL_SET, resolveScope);
    if (setClass != null && setClass.getTypeParameters().length == 1) {
      return facade.getElementFactory().createType(setClass, type);
    }

    return facade.getElementFactory().createTypeByFQClassName(JAVA_UTIL_SET, resolveScope);
  }
 @NotNull
 public static PsiClassType createTypeByFQClassName(
     @NotNull String fqName, @NotNull PsiElement context) {
   return GroovyPsiManager.getInstance(context.getProject())
       .createTypeByFQClassName(fqName, context.getResolveScope());
 }