swiftlang / swiftlang/swift-java
Consider various @Nullable @Nonnull annotations when importing types
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 1.2k
- Forks
- 123
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 16
Description
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:
- https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/package-summary.html
- CheckForNull, Nullable , Nonnull so those are in javax
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating JavaKit's type-import and nullability handling. Review the JSR-305, JSpecify, and Micrometer annotation names listed in the issue, then determine how their semantics should inform Swift imports. Done means the chosen annotation strategy is implemented consistently and its behavior is verified by the relevant existing checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100