NonNullFields and NonNullApi support annotations on the entire module rather than just the package
Comment From: snicoll
@Silentdoer a title without a description does not make a valid request. Please edit the title to describe what you mean.
Edit: copy/pasting the title is not what I had in mind. Please provide more details.
Comment From: bclozel
This enhancement request is still not clear to me. Are we talking about Java modules (as in JPMS), project modules that will produce JARs, something else entirely?
It would be nice to also show an example of the expected behavior and the problem that this feature should solve.
Comment From: Silentdoer
What I mean by this is that these two annotations can be annotated on the project/module, rather than just on the package, because I want the whole project to be null-safe, and the annotations for one package are too cumbersome
Comment From: snicoll
Thanks for the feedback. I understand you'd like to set those two annotations at the "root" of the project so that you don't have to repeat them on every package. This has nothing to do with Spring, really and there's no notion of annotating a module/project that I am aware of.
Comment From: sbrannen
@Silentdoer, just to be clear: are you proposing that org.springframework.lang.NonNullFields
and org.springframework.lang.NonNullApi
be modified as follows?
@Target({ElementType.PACKAGE, ElementType.MODULE})
Comment From: Silentdoer
@Silentdoer, just to be clear: are you proposing that
org.springframework.lang.NonNullFields
andorg.springframework.lang.NonNullApi
be modified as follows?
java @Target({ElementType.PACKAGE, ElementType.MODULE})
yes
Comment From: Silentdoer
@Silentdoer, just to be clear: are you proposing that
org.springframework.lang.NonNullFields
andorg.springframework.lang.NonNullApi
be modified as follows?
java @Target({ElementType.PACKAGE, ElementType.MODULE})
maybe also CLASS
Comment From: sbrannen
Thanks for the confirmation, @Silentdoer.
Now we understand what you are requesting.
As @bclozel pointed out earlier, "it would be nice to [explain] the problem that this feature should solve."
If Spring were to allow @NonNullFields
and @NonNullApi
to be declared in module-info
(MODULE
) or on types (TYPE
), how would you directly benefit from that?
Do you use a tool (build tool or IDE) that honors JSR-305 meta-annotations on modules and classes?
Does Kotlin honor JSR-305 meta-annotations on modules and classes?
Comment From: sbrannen
If Spring were to allow
@NonNullFields
and@NonNullApi
to be declared inmodule-info
(MODULE
) or on types (TYPE
), how would you directly benefit from that?
More importantly, why do you rely on Spring's null-safety annotations in your own code base?
These annotations are primarily intended for use within the Spring Framework itself.
Please keep in mind that you can use JSR-305 annotations on your own or via other third-party libraries that provide null-safety annotations meta-annotated with JSR-305 annotations.
Comment From: Silentdoer
@Silentdoer, just to be clear: are you proposing that
org.springframework.lang.NonNullFields
andorg.springframework.lang.NonNullApi
be modified as follows?
java @Target({ElementType.PACKAGE, ElementType.MODULE})
maybe also
If Spring were to allow
@NonNullFields
and@NonNullApi
to be declared inmodule-info
(MODULE
) or on types (TYPE
), how would you directly benefit from that?More importantly, why do you rely on Spring's null-safety annotations in your own code base?
These annotations are primarily intended for use within the Spring Framework itself.
Please keep in mind that you can use JSR-305 annotations on your own or via other third-party libraries that provide null-safety annotations meta-annotated with JSR-305 annotations.
IDEA can recognize these two annotations
Comment From: Silentdoer
JSR-305 annotations just has single field annotation