google / google/guice

Annotate API with javax.annotation.Nullable/Nonnull for Kotlin Interop

Open
#1,159 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

Hi, maintainer of [Kotlin-Guiced](https://github.com/JLLeitschuh/kotlin-guiced) here.

It would be really nice if Guice packages/classes were annotated with the `javax.annotation.*` annotations.

These are the various ways that the Kotlin language handles Null annotations. If the whole API is null safe then you can simply slap an annotation on the `package-info.java` file and that's it.
https://kotlinlang.org/docs/reference/java-interop.html#nullability-annotations

Without these the Kotlin compiler gives a lot of warnings about the library not specifying forcing developers to explicitly null check in order to remove the warning; often in places where checking for null isn't required because the library won't return a null value.

Is this something that the team would consider doing? If not, would you accept a PR adding this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.