Skip to content

Commit

Permalink
HV-1884 Use LinkedHashSet to make composingConstraints order predicta…
Browse files Browse the repository at this point in the history
…ble/guaranteed by insertion order
  • Loading branch information
Katalystical authored and gsmet committed Feb 22, 2022
1 parent 060efaf commit 44f1f8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap;
import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet;
import static org.hibernate.validator.internal.util.CollectionHelper.newLinkedHashSet;

import java.io.Serializable;
import java.lang.annotation.Annotation;
Expand Down Expand Up @@ -615,7 +616,7 @@ private void ensureAttributeIsOverridable(Method m, OverridesAttribute overrides

private Set<ConstraintDescriptorImpl<?>> parseComposingConstraints(ConstraintHelper constraintHelper, Constrainable constrainable,
ConstraintType constraintType) {
Set<ConstraintDescriptorImpl<?>> composingConstraintsSet = newHashSet();
Set<ConstraintDescriptorImpl<?>> composingConstraintsSet = newLinkedHashSet();
Map<ClassIndexWrapper, Map<String, Object>> overrideParameters = parseOverrideParameters();
Map<Class<? extends Annotation>, ComposingConstraintAnnotationLocation> composingConstraintLocations = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.concurrent.ConcurrentHashMap;

/**
Expand Down Expand Up @@ -68,6 +69,10 @@ public static <T> HashSet<T> newHashSet(Iterable<? extends T> iterable) {
return set;
}

public static <T> LinkedHashSet<T> newLinkedHashSet() {
return new LinkedHashSet<T>();
}

public static <T> ArrayList<T> newArrayList() {
return new ArrayList<T>();
}
Expand Down

0 comments on commit 44f1f8d

Please sign in to comment.