Annotation Type NonNullByDefault


  • @Documented
    @Retention(SOURCE)
    @Target({PACKAGE,TYPE})
    public @interface NonNullByDefault
    Denotes that all parameters, fields or methods within a class or method by default can not be null. This can be overridden by adding specific Nullable annotations on fields, parameters or methods that should not use the default.

    NOTE: Eclipse does not yet handle defaults well (in particular, if you add this on a class which implements Comparable, then it will insist that your compare method is changing the nullness of the compare parameter, so you'll need to add @Nullable on it, which also is not right (since the method should have implied @NonNull and you do not need to check the parameter.). For now, it's best to individually annotate methods, parameters and fields.

    This is a marker annotation and it has no specific attributes.