Skip to content

Use JSpecify nullability annotations#306

Merged
jwharm merged 11 commits intomainfrom
jspecify
Dec 9, 2025
Merged

Use JSpecify nullability annotations#306
jwharm merged 11 commits intomainfrom
jspecify

Conversation

@jwharm
Copy link
Owner

@jwharm jwharm commented Dec 9, 2025

Fixes #152

All bindings generated by Java-GI are now annotated as @NullMarked on the module level (in module-info.java). The parameters and return values that are nullable, are annotated as @Nullable.

This should improve the usability of the generated API with null-safe languages like Kotlin.

- replaced JetBrains Annotations with JSpecify
- set `Nullable` annotation on generated method parameters and return values that are explicitly marked as nullable in the gir
- remove `NotNull` annotations for now
- Update several java-gi core classes to be NullMarked
Separated null checks from null annotations;
Pointers are not nullable by default
@jwharm jwharm merged commit f762786 into main Dec 9, 2025
@jwharm jwharm deleted the jspecify branch December 9, 2025 20:55
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 JSpecify nullability annotations

1 participant