jakartaee / common-annotations-api

Jakarta Annotations
https://eclipse.org/ee4j/ca
Other
53 stars 39 forks source link

Provide two annotations, NonnullField and NonnullApi #124

Open Silentdoer opened 11 months ago

Silentdoer commented 11 months ago

Like in Spring, non null annotations can be added to all fields in the class and method parameter return values, And it should be able to support annotation of the entire project/module

xenoterracide commented 8 months ago

I'd like to see the converse also added NullField and NullApi, this way you could enforce being explicit.

Honestly this is low hanging fruit, I have time on my plate and would be willing to contribute these, as well as any underlying needed duplication of JSR-305 to support them (I notice spring's annotations compose JSR-305 code)

sdeleuze commented 8 months ago

Hey, Spring Framework committer here. I am not sure that would be as simple as adding those 2 additional annotations since:

In a nutshell, going beyond simple @Nonnull and @Nullable annotations is a huge task that is much more involved that it seems, as proven in https://github.com/jspecify/jspecify related work.