boolean (@NotNull PsiVariable variable, @NotNull PsiType targetType) { if (!PsiUtil.isJvmLocalVariable(variable)) return true; PsiElement block = PsiUtil.getVariableCodeBlock(variable, null); List<PsiReferenceExpression> refs = VariableAccessUtils.getVariableReferences(variable, block); if (refs.isEmpty()) return false; Project project = variable.getProject(); TypeMigrationRules rules = new TypeMigrationRules(project); rules.setBoundScope(variable.getUseScope()); TypeMigrationLabeler labeler = new TypeMigrationLabeler(rules, targetType, project); for (PsiReferenceExpression ref : refs) { labeler.getTypeEvaluator().setType(new TypeMigrationUsageInfo(ref), targetType); if (rules.findConversion(variable.getType(), targetType, null, ref, labeler) != null) { return true; } } return false; }