LocalQuickFix (Object... infos) { if (infos.length != 1) return null; PsiLocalVariable localVariable = (PsiLocalVariable)infos[0]; PsiType[] parameters = CollectionReplaceableByEnumCollectionVisitor.extractParameterType(localVariable, 2); if (parameters == null) return null; PsiType enumParameter = parameters[0]; String parameterListText = Arrays.stream(parameters).map(PsiType::getCanonicalText).collect(Collectors.joining(",", "<", ">")); PsiClass probablyEnum = PsiUtil.resolveClassInClassTypeOnly(enumParameter); if (probablyEnum == null || !probablyEnum.isEnum()) return null; String text = "new java.util.EnumMap" + parameterListText + "(" + enumParameter.getCanonicalText() + ".class)"; return new ReplaceExpressionWithTextFix(text, CommonQuickFixBundle.message("fix.replace.with.x", "EnumMap")); }