The method validation in Hibernate Validator can tell callers that the return value is @NotNull
, but how can I tell the caller that the return value might be null? In Findbugs, I have @CheckForNull
, but that's only active at compile time, not at run time.
Asked
Active
Viewed 87 times
0

eerriicc
- 1,124
- 4
- 17
- 29
1 Answers
0
it sounds like you are asking for something like @Nullable. That is not part of Bean Validation and most likely won't be. See also the discussion of the expert group around this - http://lists.jboss.org/pipermail/beanvalidation-dev/2013-January/thread.html
What can you achieve with a @Nullable anyways. In the context of Bean Validation, the implementation would just always return true.

Hardy
- 18,659
- 3
- 49
- 65
-
Well, it would be an alternative to compile-time checks with JSR-305. I agree that in a validation context, it doesn't make sense. But then mixing JSR-303 and JSR-305 annotation doesn't make a lot of sense, either ;-) – eerriicc Jan 15 '13 at 10:41