void (@NotNull HighlightInfo.Builder highlightInfo, PsiExpression expression, PsiType lType) { expression = PsiUtil.deparenthesizeExpression(expression); if (!(expression instanceof PsiNewExpression newExpression)) return; final PsiType rType = expression.getType(); PsiType newType = lType; if (rType instanceof PsiClassType rClassType && newType instanceof PsiClassType newClassType) { final PsiClassType.ClassResolveResult rResolveResult = rClassType.resolveGenerics(); PsiClass rClass = rResolveResult.getElement(); if (rClass instanceof PsiAnonymousClass) { rClass = ((PsiAnonymousClass)rClass).getBaseClassType().resolve(); } if (rClass != null) { final PsiClassType.ClassResolveResult lResolveResult = newClassType.resolveGenerics(); final PsiClass lClass = lResolveResult.getElement(); if (lClass != null) { PsiSubstitutor substitutor = getInheritorSubstitutorForNewExpression(lClass, rClass, lResolveResult.getSubstitutor(), expression); if (substitutor != null) { newType = JavaPsiFacade.getElementFactory(lClass.getProject()).createType(rClass, substitutor); } } } } if (rType == null || newType.getCanonicalText().equals(rType.getCanonicalText())) return; final PsiClass aClass = PsiTypesUtil.getPsiClass(newType); if (aClass != null && (aClass.isEnum() || aClass.isAnnotationType())) return; highlightInfo.registerFix(new ChangeNewOperatorTypeFix(newType, newExpression), null, null, null, null); }