Skip to content

Add TYPE_USE to @NonNull for type-use annotation support #35289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

yuvarajapril91
Copy link

Motivation

This PR adds ElementType.TYPE_USE to the @Target annotation for @NonNull, enabling it to be used in type-use positions (such as generic type parameters and return types) in addition to methods, parameters, and fields. This supports modern null-safety tooling and aligns with best practices in the Java ecosystem.

Javadoc has been updated to reflect this expanded usage.

Checklist

This allows @nonnull to be used in type-use positions (such as generic type parameters and return types), in addition to methods, parameters, and fields. This enables broader compatibility with modern null-safety tools and aligns with common usage in the Java ecosystem.

Signed-off-by: yuvarajapril91 <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 5, 2025
@bclozel
Copy link
Member

bclozel commented Aug 5, 2025

This type is now deprecated in favor of JSpecify annotations. We don't intend to evolve this as a result.

@bclozel bclozel closed this Aug 5, 2025
@bclozel bclozel added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants