Skip to content

Commit 42a890c

Browse files
Gravewalker666mtdowling
authored andcommitted
Change the order of the parameters
1 parent ea5642e commit 42a890c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • core/src/main/java/software/amazon/smithy/java/core/schema

core/src/main/java/software/amazon/smithy/java/core/schema/Validator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static final class ShapeValidator implements ShapeSerializer, MapSerializer {
127127
private static final List<CustomConstraint>[] CUSTOM_CONSTRAINTS_BY_TYPE = new List[ShapeType.values().length];
128128
private static final boolean HAS_CUSTOM_CONSTRAINTS;
129129

130-
private static void addConstraint(CustomConstraint constraint, int index) {
130+
private static void addConstraint(int index, CustomConstraint constraint) {
131131
if (CUSTOM_CONSTRAINTS_BY_TYPE[index] == null) {
132132
CUSTOM_CONSTRAINTS_BY_TYPE[index] = new ArrayList<>();
133133
}
@@ -140,12 +140,13 @@ private static void addConstraint(CustomConstraint constraint, int index) {
140140
for (var constraint : loader) {
141141
var types = constraint.appliesTo();
142142
if (types.isEmpty()) {
143+
// Add the constraint to all types if the enum set is empty
143144
for (var i = 0; i < CUSTOM_CONSTRAINTS_BY_TYPE.length; i++) {
144-
addConstraint(constraint, i);
145+
addConstraint(i, constraint);
145146
}
146147
} else {
147148
for (var type : types) {
148-
addConstraint(constraint, type.ordinal());
149+
addConstraint(type.ordinal(), constraint);
149150
}
150151
}
151152
}

0 commit comments

Comments
 (0)