Back
I saw some method in java declared as:
void foo(@Nullable Object obj){ ... }
void foo(@Nullable Object obj)
{ ... }
What's the meaning of @Nullable here? Does it mean the input could be null? Without the annotation, the input can still be null, so I guess that's not just it?
Thanks
This delivers it explicit that the method allows null values, and that if you reverse the method, you should also acquire null values.
It also assists as a reference for code analyzers like FindBugs. For instance, if such a program dereferences its argument without holding for null first, FindBugs will release a warning.
31k questions
32.8k answers
501 comments
693 users