PsiElement () { for (int i = 0; i < processedInstructions.length; i++) { if (!processedInstructions[i]) { PsiElement element = myFlow.getElement(i); final PsiElement unreachableParent = getUnreachableExpressionParent(element); if (unreachableParent != null) { return correctUnreachableStatement(unreachableParent); } if (element == null || !PsiUtil.isStatement(element)) continue; if (element.getParent() instanceof PsiExpression) continue; // ignore for(;;) statement unreachable update while (element instanceof PsiExpression) { element = element.getParent(); } if (element instanceof PsiStatement && element.getParent() instanceof PsiForStatement && element == ((PsiForStatement)element.getParent()).getUpdate()) { continue; } //filter out generated statements final int endOffset = myFlow.getEndOffset(element); if (endOffset != i + 1) continue; final int startOffset = myFlow.getStartOffset(element); // this offset actually is a part of reachable statement if (0 <= startOffset && startOffset < processedInstructions.length && processedInstructions[startOffset]) continue; final PsiElement enclosingStatement = getEnclosingUnreachableStatement(element); return enclosingStatement != null ? enclosingStatement : element; } } return null; }