void (@Nullable HighlightInfo.Builder builder, @NotNull PsiVariable variable, @NotNull PsiReferenceParameterList parameterList, @NotNull JavaSdkVersion version) { PsiType type = variable.getType(); if (!(type instanceof PsiClassType) || builder == null) return; if (DumbService.getInstance(variable.getProject()).isDumb()) return; String shortName = ((PsiClassType)type).getClassName(); PsiManager manager = parameterList.getManager(); JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject()); PsiShortNamesCache shortNamesCache = PsiShortNamesCache.getInstance(parameterList.getProject()); PsiClass[] classes = shortNamesCache.getClassesByName(shortName, GlobalSearchScope.allScope(manager.getProject())); PsiElementFactory factory = facade.getElementFactory(); for (PsiClass aClass : classes) { if (aClass == null) { LOG.error("null class returned for " + shortName); continue; } if (checkReferenceTypeArgumentList(aClass, parameterList, PsiSubstitutor.EMPTY, false, version) == null) { PsiType[] actualTypeParameters = parameterList.getTypeArguments(); PsiTypeParameter[] classTypeParameters = aClass.getTypeParameters(); Map<PsiTypeParameter, PsiType> map = new HashMap<>(); for (int j = 0; j < Math.min(classTypeParameters.length, actualTypeParameters.length); j++) { PsiTypeParameter classTypeParameter = classTypeParameters[j]; PsiType actualTypeParameter = actualTypeParameters[j]; map.put(classTypeParameter, actualTypeParameter); } PsiSubstitutor substitutor = factory.createSubstitutor(map); PsiType suggestedType = factory.createType(aClass, substitutor); HighlightFixUtil.registerChangeVariableTypeFixes(variable, suggestedType, variable.getInitializer(), builder); } } }