[bv-dev] BVAL-341 - @Nullable

Emmanuel Bernard emmanuel at hibernate.org
Wed Jan 2 07:15:45 EST 2013


Hello,

Matthew argues for a new basic constraint named `@Nullable`. The goal is
to make it clear when an element is nullable. Today you can guess it
from the fact that it does not host a `@NotNull` constraint. But it's
ambiguous as someone might have simply forgotten the constraint.

https://hibernate.onjira.com/browse/BVAL-341

I am not in favor of this for a few reasons. I think what Matthew is
after is `@Nullable` with the semantic of JSR 305: the element is always
nullable no matter what - and possibly can be computed by a tool at
compile time. But since Bean Validation is only validated at specific
moments in the life cycle of an object or method and that different
groups can be validated, I don't feel that `@Nullable` would bring all
the promises one would expect.

Thoughts?

Emmanuel


More information about the beanvalidation-dev mailing list