private boolean variableNeverAssignedNull(@NotNull PsiVariable variable) {
        final PsiExpression initializer = variable.getInitializer();
        if (initializer != null) {
            if (!expressionIsNeverNull(initializer)) {
                return false;
            }
        } else if (!variable.hasModifierProperty(PsiModifier.FINAL)) {
            return false;
        } else if (variable instanceof PsiParameter parameter && parameter.getDeclarationScope() instanceof PsiCatchSection) {
            return false;
        }

        SearchScope scope = getScope(variable);
        if (scope == null) {
            return false;
        }

        final Query<PsiReference> references = ReferencesSearch.search(variable, scope);
        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;
    }
private boolean variableNeverAssignedNull(@NotNull PsiVariable variable)