void (@NotNull TypeMigrationUsageInfo usageInfo, @NotNull Consumer<? super PsiNewExpression> consumer) { final PsiElement element = usageInfo.getElement(); if (element == null) return; final Project project = element.getProject(); if (element instanceof PsiExpression expression) { if (element instanceof PsiNewExpression) { for (Map.Entry<TypeMigrationUsageInfo, PsiType> info : myNewExpressionTypeChange.entrySet()) { final PsiElement expressionToReplace = info.getKey().getElement(); if (expression.equals(expressionToReplace)) { final PsiNewExpression newExpression = TypeMigrationReplacementUtil.replaceNewExpressionType(project, (PsiNewExpression)expressionToReplace, info.getValue()); if (newExpression != null) { consumer.consume(newExpression); } } } } final Object conversion = myRemainConversions.get(usageInfo); if (conversion != null) { myRemainConversions.remove(usageInfo); TypeMigrationReplacementUtil.replaceExpression(expression, project, conversion, myTypeEvaluator); } } else if (element instanceof PsiReferenceParameterList) { for (Map.Entry<TypeMigrationUsageInfo, PsiClassType> entry : myClassTypeArgumentsChange.entrySet()) { if (element.equals(entry.getKey().getElement())) { //todo check null final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); try { element.getParent().replace(factory.createReferenceElementByType(entry.getValue())); } catch (IncorrectOperationException e) { LOG.error(e); } } } } else if ((element instanceof PsiField || element instanceof PsiLocalVariable) && isMultiVariableDeclaration((PsiVariable)element)) { final PsiTypeElement typeElement = ((PsiVariable)element).getTypeElement(); if (typeElement != null) myVariableMigration.putValue(typeElement, usageInfo); } else { TypeMigrationReplacementUtil.migrateMemberOrVariableType(element, project, getTypeEvaluator().getType(usageInfo)); if (usageInfo instanceof OverriddenUsageInfo) { final String migrationName = ((OverriddenUsageInfo)usageInfo).getMigrateMethodName(); if (migrationName != null) { ApplicationManager.getApplication().invokeLater(() -> { if (element.isValid()) { new RenameProcessor(project, element, migrationName, false, false).run(); } }); } } } }