boolean (@NotNull PsiVariable variable) { final PsiExpression initializer = variable.getInitializer(); if (initializer != null) { if (!expressionIsNeverNull(initializer)) { return false; } } else if (!variable.hasModifierProperty(PsiModifier.FINAL) || variable instanceof PsiParameter && ((PsiParameter)variable).getDeclarationScope() instanceof PsiCatchSection) { return false; } final Query<PsiReference> references = ReferencesSearch.search(variable); for (final PsiReference reference : references) { final PsiElement element = reference.getElement(); if (!(element instanceof PsiReferenceExpression)) { continue; } final PsiElement parent = element.getParent(); if (!(parent instanceof PsiAssignmentExpression assignment)) { continue; } if (assignment.getLExpression().equals(element) && !expressionIsNeverNull(assignment.getRExpression())) { return false; } } return true; }