79414479

Date: 2025-02-05 10:52:25
Score: 2.5
Natty:
Report link

As Rob Spoor answered in comments, everything is correct, NotNull works before validator.

first each validation takes place without throwing any errors, then all validation errors are collected and wrapped in a single ConstraintViolationException. That's why it has a set of violations. That's why when implementing a constraint validator, the first step is to return true if the thing to validate is null. If it shouldn't be null then let @NotNull handle that.

Reasons:
  • No code block (0.5):
  • User mentioned (1): @NotNull
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Eugene_Z