|
35 | 35 | import software.amazon.smithy.model.shapes.Shape; |
36 | 36 | import software.amazon.smithy.model.shapes.ShapeId; |
37 | 37 | import software.amazon.smithy.model.shapes.ShapeVisitor; |
| 38 | +import software.amazon.smithy.model.shapes.SimpleShape; |
38 | 39 | import software.amazon.smithy.model.shapes.StructureShape; |
39 | 40 | import software.amazon.smithy.model.shapes.UnionShape; |
40 | 41 | import software.amazon.smithy.utils.OptionalUtils; |
@@ -135,26 +136,12 @@ private void assertShapeTypeChangesSound(Model model, List<Shape> shouldReplace) |
135 | 136 | }); |
136 | 137 | } |
137 | 138 |
|
138 | | - private boolean isReplaceable(Shape shape) { |
139 | | - return !shape.isDocumentShape() |
140 | | - && !shape.isMapShape() |
141 | | - && !shape.isMemberShape() |
142 | | - && !shape.isOperationShape() |
143 | | - && !shape.isResourceShape() |
144 | | - && !shape.isServiceShape() |
145 | | - && !shape.isStructureShape() |
146 | | - && !shape.isUnionShape(); |
147 | | - } |
148 | | - |
149 | 139 | private boolean isReplacementValid(Model model, Shape left, Shape right) { |
150 | | - if (isListCollection(left) && isListCollection(right)) { |
| 140 | + if (left instanceof CollectionShape && right instanceof CollectionShape) { |
151 | 141 | validateListCollectionReplacement(model, (CollectionShape) left, (CollectionShape) right); |
| 142 | + return true; |
152 | 143 | } |
153 | | - return isReplaceable(left) && isReplaceable(right) && isListCollection(left) == isListCollection(right); |
154 | | - } |
155 | | - |
156 | | - private boolean isListCollection(Shape shape) { |
157 | | - return shape.isListShape() || shape.isSetShape(); |
| 144 | + return left instanceof SimpleShape && right instanceof SimpleShape; |
158 | 145 | } |
159 | 146 |
|
160 | 147 | private void validateListCollectionReplacement(Model model, CollectionShape left, CollectionShape right) { |
|
0 commit comments