We're updating the issue view to help you get more done. 

Not defined order of composed constraints processing

Description

Here is an ability to arrange multiple constraints into the single constraint such as below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 @NotNull @Size(min = 2, max = 14) @CheckCase(CaseMode.UPPER) @Target({ METHOD, FIELD, ANNOTATION_TYPE }) @Retention(RUNTIME) @Constraint(validatedBy = { }) @Documented public @interface ValidLicensePlate { String message() default "{org.hibernate.validator.referenceguide.chapter06." + "constraintcomposition.ValidLicensePlate.message}"; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { }; }

In this case annotations @NotNull, @Size and @CheckCase will be processed as a single @ValidLicensePlate constraint. But the execution order of @NotNull, @Size and @CheckCase annotations can not be defined and sometimes it breaks validation by throwing exception.
I've found that this bug is inside of a constructor of the org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTre class.
Child constraints can be sorted by groups such top level constraints.

Environment

None

Status

Assignee

Unassigned

Reporter

Ruslan Yanyuk

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

5.2.2.Final

Priority

Major