Skip to content

Introduce a dedicated nullness API #34261

Closed
@sdeleuze

Description

@sdeleuze

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.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions