PsiType (@NotNull PsiElement context, @Nullable PsiType qualifierType, boolean captureTopLevelWildcards) { if (qualifierType != null) { PsiUtil.ensureValidType(qualifierType); JavaPsiFacade facade = JavaPsiFacade.getInstance(context.getProject()); PsiClass javaLangClass = facade.findClass(CommonClassNames.JAVA_LANG_CLASS, context.getResolveScope()); if (javaLangClass != null && javaLangClass.getTypeParameters().length == 1) { PsiSubstitutor substitutor = PsiSubstitutor.EMPTY. put(javaLangClass.getTypeParameters()[0], PsiWildcardType.createExtends(context.getManager(), qualifierType)); final PsiClassType classType = facade.getElementFactory().createType(javaLangClass, substitutor, PsiUtil.getLanguageLevel(context)); return captureTopLevelWildcards ? PsiUtil.captureToplevelWildcards(classType, context) : classType; } } return null; }