JetBrains / java-annotations

Annotations for JVM-based languages.
Apache License 2.0
407 stars 47 forks source link

Module-level `@NotNullByDefault` #113

Open CC007 opened 1 month ago

CC007 commented 1 month ago

In July the @NotNullByDefault annotation was added. This annotation can be used with target TYPE and PACKAGE, but sometimes you would want to have your fields, parameters and return types in (almost) every package in your module be default not null.

Therefore I propose to add the MODULE element type to the target annotation So: @Target(value={TYPE,PACKAGE,MODULE}) instead of @Target(value={TYPE,PACKAGE})

This would also require changes in any annotation processor, IDE or language server that acts on the @NotNullByDefault. I don't know to what extent that is part of this repo.

CC007 commented 1 month ago

This issue was made in response to the comments on #18

Maybe one day the @NotNullByDefault annotation could be expanded with a boolean applyToSubPackages parameter.

This is not a good idea. [...] This problem should be solved with module-level annotation.