Comparator<Shape> shapeComparator() {
        return this == PREFERRED ? new PreferredShapeComparator() : toShapeIdComparator();
    }
Reorganizes shapes based on a preferred ordering of shapes, and alphanumeric traits and metadata.

<p>Shapes are ordered as follows:

<ul>
    <li>Trait definitions</li>
    <li>Services</li>
    <li>Resources</li>
    <li>Operations</li>
    <li>Structures</li>
    <li>Unions</li>
    <li>Lists</li>
    <li>Maps</li>
    <li>Finally, alphabetically by shape type.</li>
</ul>
smithy-model/src/main/java/software/amazon/smithy/model/shapes/SmithyIdlComponentOrder.java