public Collection<PsiStatement> prepareExitStatements( final @NotNull PsiElement[] elements, final @NotNull PsiElement enclosingCodeFragment) throws ExitStatementsNotSameException { myExitPoints = new IntArrayList(); myExitStatements = ControlFlowUtil.findExitPointsAndStatements( myControlFlow, myFlowStart, myFlowEnd, myExitPoints, ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES); if (ControlFlowUtil.hasObservableThrowExitPoints( myControlFlow, myFlowStart, myFlowEnd, elements, enclosingCodeFragment)) { throw new ExitStatementsNotSameException(); } if (LOG.isDebugEnabled()) { LOG.debug("exit points:"); for (int i = 0; i < myExitPoints.size(); i++) { LOG.debug(" " + myExitPoints.get(i)); } LOG.debug("exit statements:"); for (PsiStatement exitStatement : myExitStatements) { LOG.debug(" " + exitStatement); } } if (myExitPoints.isEmpty()) { // if the fragment never exits assume as if it exits in the end myExitPoints.add(myControlFlow.getEndOffset(elements[elements.length - 1])); } if (myExitPoints.size() != 1) { myGenerateConditionalExit = true; areExitStatementsTheSame(); } return myExitStatements; }