boolean (@NotNull final PsiVariable variable, @NotNull final PsiElement scope, @NotNull final PsiElement start, @NotNull final PsiElement end) { if (variable.hasModifierProperty(PsiModifier.FINAL) || HighlightControlFlowUtil.isEffectivelyFinal(variable, scope, null)) { return false; } PsiElement broadEnd = getBroadEnd(scope, start, end); ControlFlow controlFlow; try { controlFlow = ControlFlowFactory.getInstance(variable.getProject()).getControlFlow(scope, new LocalsControlFlowPolicy(scope), true); } catch (AnalysisCanceledException ignored) { controlFlow = ControlFlow.EMPTY; } int startOffset = controlFlow.getEndOffset(start) + 1; int endOffset = controlFlow.getEndOffset(broadEnd); return ControlFlowUtil.getWrittenVariables(controlFlow, startOffset, endOffset, true).contains(variable); }