Community
Participate
Working Groups
Created attachment 270805 [details] FullNonNullByDefault.java example to illustrate the idea proposed here This is a (certainly low priority) enhancement suggestion, not a bug: In an ideal world, once more pressing things are taken care of, it would be nice if @NonNullByDefault would support "meta annotations". A "meta annotation" is not a core Java language feature, but a convention which has gained widespread use, e.g. in the popular Spring Framework and others or in something like http://immutables.org; see their documentation about this here: http://immutables.github.io/style.html#custom-immutable-annotation Attached is an FullNonNullByDefault.java example for how I would imagine something like this would look like, which one could us instead of having to repeat the long list of all DefaultLocation (because TYPE_PARAMETER & ARRAY_CONTENTS are not includd by default) in every bloody package-info.java: // Add TYPE_PARAMETER & ARRAY_CONTENTS to NonNullByDefault value() default: @NonNullByDefault({ PARAMETER, RETURN_TYPE, FIELD, TYPE_PARAMETER, TYPE_BOUND, TYPE_ARGUMENT, ARRAY_CONTENTS }) public @interface FullNonNullByDefault { // nothing here, the point of this is above }
Bug 518839 sounds a bit related. In case one of them is implemented, the other one shouldn't be too hard.
I think this is not needed, you can simply define secondary NonNullByDefault-annotations with different default values.