@SuppressWarnings("unchecked")
    public T pushState() {
        currentState = new State(currentState);
        states.push(currentState);
        return (T) this;
    }
Copies and pushes the current state to the state stack.

<p>This method is used to prepare for a corresponding {@link #popState}
operation later. It stores the current state of the AbstractCodeWriter into a
stack and keeps it active. After pushing, mutations can be made to the
state of the AbstractCodeWriter without affecting the previous state on the
stack. Changes to the state of the AbstractCodeWriter can be undone by using
{@link #popState()}, which Returns self state to the state
it was in before calling {@code pushState}.

@return Returns the code writer.
smithy-utils/src/main/java/software/amazon/smithy/utils/AbstractCodeWriter.java