IntList (@NotNull List<? extends PsiTryStatement> tryStatements, @NotNull List<? extends PsiClassType> thrownExceptions) { final IntList catchOrFinallyOffsets = new IntArrayList(); for (PsiTryStatement tryStatement : tryStatements) { final PsiCodeBlock finallyBlock = tryStatement.getFinallyBlock(); if (finallyBlock != null) { int offset = flow.getStartOffset(finallyBlock); if (offset >= 0) { catchOrFinallyOffsets.add(offset - 2); // -2 is an adjustment for rethrow-after-finally } } for (PsiCatchSection catchSection : tryStatement.getCatchSections()) { final PsiCodeBlock catchBlock = catchSection.getCatchBlock(); final PsiParameter parameter = catchSection.getParameter(); if (catchBlock != null && parameter != null) { for (PsiClassType throwType : thrownExceptions) { if (isCaughtExceptionType(throwType, parameter.getType())) { int offset = flow.getStartOffset(catchBlock); if (offset >= 0) { catchOrFinallyOffsets.add(offset - 1); // -1 is an adjustment for catch block initialization } } } } } } return catchOrFinallyOffsets; }