boolean (@NotNull PsiTryStatement tryStatement, PsiVariable variable, @NotNull Set<MethodSignature> checkedMethods, boolean strict) { final PsiResourceList resourceList = tryStatement.getResourceList(); if (resourceList != null) { for (PsiResourceListElement resource : resourceList) { if (resource instanceof PsiResourceVariable) { final PsiExpression initializer = ((PsiResourceVariable)resource).getInitializer(); if (expressionAssignsVariableOrFails(initializer, variable, checkedMethods, strict)) { return true; } } } } boolean initializedInTryAndCatch = blockAssignsVariableOrFails(tryStatement.getTryBlock(), variable, checkedMethods, strict); final PsiCodeBlock[] catchBlocks = tryStatement.getCatchBlocks(); for (final PsiCodeBlock catchBlock : catchBlocks) { if (strict) { initializedInTryAndCatch &= ExceptionUtils.blockThrowsException(catchBlock); } else { initializedInTryAndCatch &= blockAssignsVariableOrFails(catchBlock, variable, checkedMethods, false); } } return initializedInTryAndCatch || blockAssignsVariableOrFails(tryStatement.getFinallyBlock(), variable, checkedMethods, strict); }