boolean (@NotNull PsiTryStatement tryStatement, @NotNull PsiVariable variable, int stamp, @NotNull Set<MethodSignature> checkedMethods) { final PsiResourceList resourceList = tryStatement.getResourceList(); if (resourceList != null) { for (PsiResourceListElement resource : resourceList) { if (resource instanceof PsiResourceVariable) { final PsiExpression initializer = ((PsiResourceVariable)resource).getInitializer(); if (expressionAssignsVariable(initializer, variable, stamp, checkedMethods)) { return true; } } } } final PsiCodeBlock tryBlock = tryStatement.getTryBlock(); boolean initializedInTryOrCatch = blockAssignsVariable(tryBlock, variable, stamp, checkedMethods); final PsiCodeBlock[] catchBlocks = tryStatement.getCatchBlocks(); for (final PsiCodeBlock catchBlock : catchBlocks) { initializedInTryOrCatch &= blockAssignsVariable(catchBlock, variable, stamp, checkedMethods); } if (initializedInTryOrCatch) { return true; } final PsiCodeBlock finallyBlock = tryStatement.getFinallyBlock(); return blockAssignsVariable(finallyBlock, variable, stamp, checkedMethods); }