void (@NotNull PsiLocalVariable variable, @NotNull PsiExpression valueExpression, @NotNull PsiType migrationType) { final PsiCodeBlock codeBlock = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class); final PsiElement[] refs = DefUseUtil.getRefs(Objects.requireNonNull(codeBlock), variable, valueExpression); if (refs.length == 0) { myLabeler.setConversionMapping(valueExpression, new TypeConversionDescriptorBase() { @Override public PsiExpression replace(PsiExpression expression, @NotNull TypeEvaluator evaluator) throws IncorrectOperationException { final PsiElement parent = expression.getParent(); if (parent instanceof PsiLocalVariable var) { final PsiDeclarationStatement decl = PsiTreeUtil.getParentOfType(var, PsiDeclarationStatement.class); if (decl == null) return null; final Project project = var.getProject(); final PsiAssignmentExpression assignment = ExpressionUtils.splitDeclaration(decl, project); if (assignment == null) return null; final PsiExpression rExpression = assignment.getRExpression(); if (rExpression == null) return null; assignment.replace(rExpression); if (ReferencesSearch.search(var).forEach(new CommonProcessors.FindFirstProcessor<>())) { var.delete(); } } else if (parent instanceof PsiAssignmentExpression assignment) { final PsiExpression rExpression = assignment.getRExpression(); return rExpression == null ? null : (PsiExpression)parent.replace(rExpression); } return null; } }); } else { myLabeler.markFailedConversion(migrationType, valueExpression); } }