Skip to content

use jakarta.annotation to document nullability of APIs #726

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gavinking
Copy link
Contributor

see #725

@gavinking gavinking marked this pull request as draft May 30, 2025 06:13
@gavinking
Copy link
Contributor Author

Setting this to Draft mode because it's a source of conflicts with other open PRs.

@hantsy
Copy link
Contributor

hantsy commented Jul 21, 2025

For my opinion, it is better to introduce a @NullMarked or NullUnmarked like JSpecify, or use jspecify to replace the current @Nullable and @Nonnull in jakarta annotation API.

The good is using @NullMarked like annotation on class or package, and assume all parameters/fields/method result default is non null, only need to mark the @Nullable field/results, or in reverse. This way is clearer to use Nullable/Nonnull mixing in the same APIs.

Another benefit from JSpecify is the support from IDE when coding or build tools at compile time.

See: https://jspecify.dev/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use jakarta.annotation to document nullability of APIs
2 participants