protected void validateMixins(Map<ShapeId, Shape> mixins, Map<ShapeId, Trait> introducedTraits) {
        Set<String> invalid = new TreeSet<>();
        for (Shape mixin : mixins.values()) {
            if (mixin.getType() != getType()) {
                invalid.add(mixin.getId().toString());
            }
        }
        if (!invalid.isEmpty()) {
            String invalidList = String.join("`, `", invalid);
            throw new SourceException(String.format(
                    "Mixins may only be mixed into shapes of the same type. The following mixins were applied to the "
                            + "%s shape `%s` which are not %1$s shapes: [`%s`]",
                    getType(),
                    getId(),
                    invalidList),
                    source);
        }
    }
This class is package-private, which means that all subclasses of this
class must reside within the same package. Because of this, Shape is a
closed set of known concrete shape types.

@param builder Builder to extract values from.
@param expectMemberSegments True/false if the ID must have a member.
smithy-model/src/main/java/software/amazon/smithy/model/shapes/Shape.java