ReusedLocalVariablesFinder (@NotNull PsiElement fragmentEnd) { PsiStatement nextStatement = PsiTreeUtil.getNextSiblingOfType(fragmentEnd, PsiStatement.class); if (nextStatement == null) { return null; } PsiElement codeFragment = ControlFlowUtil.findCodeFragment(nextStatement); ControlFlow controlFlow; try { controlFlow = ControlFlowFactory.getControlFlow( codeFragment, new LocalsControlFlowPolicy(codeFragment), ControlFlowOptions.NO_CONST_EVALUATE); } catch (AnalysisCanceledException e) { return null; } int offset = controlFlow.getStartOffset(nextStatement); if (offset < 0) { return null; } return new ReusedLocalVariablesFinder(controlFlow, nextStatement, offset); }