PsiType (@Nullable PsiType map, @NotNull final Project project, @NotNull final GlobalSearchScope scope) { PsiType key = PsiUtil.substituteTypeParameter(map, JAVA_UTIL_MAP, 0, true); PsiType value = PsiUtil.substituteTypeParameter(map, JAVA_UTIL_MAP, 1, true); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); final PsiClass entryClass = JavaPsiFacade.getInstance(project).findClass(JAVA_UTIL_MAP_ENTRY, scope); if (entryClass == null) { if (key != null && key != PsiTypes.nullType() && value != null && value != PsiTypes.nullType()) { final String text = String.format("%s<%s,%s>", JAVA_UTIL_MAP_ENTRY, key.getCanonicalText(), value.getCanonicalText()); return factory.createTypeFromText(text, null); } else { return factory.createTypeByFQClassName(JAVA_UTIL_MAP_ENTRY, scope); } } else { return factory.createType(entryClass, key, value); } }