@SuppressWarnings("unchecked")
    public B addTrait(Trait trait) {
        Objects.requireNonNull(trait, "trait must not be null");
        traits.get().put(trait.toShapeId(), trait);
        return (B) this;
    }
Adds a trait to the shape builder, replacing any conflicting traits.

@param trait Trait instance to add.
@return Returns the builder.
smithy-model/src/main/java/software/amazon/smithy/model/shapes/AbstractShapeBuilder.java