The documentation for @ParametersAreNonnullByDefault
says, that:
This annotation can be applied to a package, class or method to indicate that the method parameters in that element are nonnull by default unless ...
I don't consider a method's return type/value to be it's parameter. It is only part of its signature, so this is kind of ambiguous for me.
The Java tutorial for methods seems to think like me.
As Joachim Sauer pointed out for me in the comments section of his answer, the name @ParametersAreNonnullByDefault
(parameters) should've clearly indicated for me that this annotation doesn't apply to methods' return types/values. I was blind! :) Thanks Joachim!
In light of this I can only says that an @EverythingIsNonnullByDefault
should exist somwhere. :)
I don't see a reason why @ParametersAreNonnullByDefault
should apply to return values.