Introduce a dedicated nullness API #34261
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
As a follow-up of #28797, this issue intends to introduce a nullness API for runtime checks since
MethodParameter#isOptional
is not specific enough for that purpose.Taking inspiration of spring-projects/spring-data-commons#3115 and this
MethodParameter#getNullness
draft, this issue intends to introduce a dedicated nullness API capable of exposingenum Nullness { UNSPECIFIED, NULLABLE, NON_NULL }
for parameters and return values.The proposed scope is full support for JSpecify + detection of any
@Nullable
annotation without taking care of the package (including Spring and JSR 305 ones).The Spring Data team via @odrotbohm has asked this API should be usable without creating a
MethodParameter
instance, so we may introduce aNullnessUtils
or similar class and related utility methods.The text was updated successfully, but these errors were encountered: