PsiElement (@NotNull PsiElement sourceElement, @Nullable PsiElement jumpElement) { PsiElement element = sourceElement; while (element != null && !(element instanceof PsiFile)) { if (element instanceof PsiCodeBlock && element.getParent() instanceof PsiTryStatement && ((PsiTryStatement)element.getParent()).getFinallyBlock() == element) { // element maybe out of scope to be analyzed if (myCurrentFlow.getStartOffset(element.getParent()) == -1) return null; if (jumpElement == null || !PsiTreeUtil.isAncestor(element, jumpElement, false)) return element; } element = element.getParent(); } return null; }