Description
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 exposing enum 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 a NullnessUtils
or similar class and related utility methods.