Skip to content

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

@ktoso

Description

@ktoso

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions