Annotation Type NonNull


@Documented @TypeQualifierNickname @Nonnull(when=ALWAYS) @Retention(RUNTIME) public @interface NonNull
Type qualifier annotation to mark a parameter, an attribute or a return value is expected to be non null. An element annotated with @NonNull claims null value isn't valid to return (for methods), pass to (parameters) or hold in (local variables and fields) and hence a NullPointerException should be thrown.

Apart from documentation purposes this annotation is intended to be used by static analysis tools to validate against probable runtime errors or element contract violations.

By defining our own annotations we ensure to be agnostic from any checking library or framework because, despite of the JSR-305, a lot of tiers provide its own incompatible solution.

Author:
mmoquillon