Skip to content
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

Consider various @Nullable @Nonnull annotations when importing types #130

Open
ktoso opened this issue Oct 28, 2024 · 2 comments
Open

Consider various @Nullable @Nonnull annotations when importing types #130

ktoso opened this issue Oct 28, 2024 · 2 comments

Comments

@ktoso
Copy link
Collaborator

ktoso commented Oct 28, 2024

While "dormant" some project do use the JSR-305 annotations, and one of them is https://www.javadoc.io/static/com.google.code.findbugs/jsr305/3.0.2/javax/annotation/Nonnull.html and Nullable

This is something that can inform how we import values to Swift in JavaKit.

The nullability ones are quite messy and there's many libraries which "have their own" since the JSR never made it into the JDK. So we should just match "by name" if an attribute is called "nullable" "nonnull" and similar names.

JSR-305 ones are:

We might care about jspecify, this is new to me but seems it's folks coming together to revive the effort:

names are NonNull Nullable and NullMarked NullUnmarked to basically say if some region was annotated at all or not.

Findbugs which is a tool "most people use" supports the JSR305 ones.

Micrometer ones exist but would be weird I guess to rely on them; Nullable is the same, but it has a few more:

So we can either list a bunch of known types or just match by the attribute name - they mostly all have the same semantics

@lhoward
Copy link
Contributor

lhoward commented Nov 1, 2024

Android also has one. :(

@ktoso
Copy link
Collaborator Author

ktoso commented Nov 1, 2024

adding it to the list: https://developer.android.com/reference/androidx/annotation/Nullable

Honestly Nullable/NonNull is not a problem I think, they all share the same name tbh, I'd just name match them or we can keep listing the explicit specific types.

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

No branches or pull requests

2 participants