Пример #1
0
  @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);
  }
Пример #2
0
 @NotNull
 public static PsiClassType createTypeByFQClassName(
     @NotNull String fqName, @NotNull PsiElement context) {
   return GroovyPsiManager.getInstance(context.getProject())
       .createTypeByFQClassName(fqName, context.getResolveScope());
 }