|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Documented @Target(value={FIELD,PARAMETER,METHOD}) @Level2Desugarable(pattern="(java.lang.Object) @Target != null", types=java.lang.Object.class) public @interface NonNull
This annotation can be used to express that
a parameter or a field is not allowed to be null
.
Note on primitive types: Since version 5, Java
enables auto-boxing
so that the @NotNull-annotation totally makes sence
for primitive types.
For instance, the @NotNull-annotation used in the code below
void m(@NotNull int a){ //.. }will save you, if one calls
m( (Integer) null);
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |