private void addSyntheticEnumTrait(Collection<MemberShape> memberShapes) {
            SyntheticEnumTrait.Builder builder = SyntheticEnumTrait.builder();
            builder.sourceLocation(getSourceLocation());
            for (MemberShape member : memberShapes) {
                try {
                    builder.addEnum(EnumShape.enumDefinitionFromMember(member));
                } catch (IllegalStateException e) {
                    // This can happen if the enum value trait is using something other
                    // than a string value. Rather than letting the exception propagate
                    // here, we let the shape validator handle it because it will give
                    // a much better error.
                    return;
                }
            }
            addTrait(builder.build());
        }
Adds a synthetic version of the enum trait.

<p>This allows the enum shape to be used as if it were a string shape with
the enum trait, without having to manually add the trait or risk that it
gets serialized.
smithy-model/src/main/java/software/amazon/smithy/model/shapes/EnumShape.java