Use @NullMarked
instead of our custom @ElementTypesAreNonnullByDefault
annotations.
#7556
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use
@NullMarked
instead of our custom@ElementTypesAreNonnullByDefault
annotations.This is the first step toward using JSpecify in Guava. At the end of that path, we'll be able to remove our dependency on JSR-305 (and on the Checker Framework's annotations), and we'll have one less blocker to providing a
module-info
.@NullMarked
allows tools like kotlinc to produce errors for code likeImmutableList<String?>
. (Before releasing this change, I'll conduct some further testing to more fully characterize the effects, both under Kotlin 2.1 and prior.) As we make further changes, it will allow kotlinc to detect even more nullness problems. We will make these changes in a series of incremental releases so that users can pick them up gradually, as we did inside Google. In simple cases, users may wish to pick up all the changes at once instead by upgrading straight from Guava 33.4.0 (or an earlier version) to Guava 33.4.4 (or whatever the version to make the final changes ends up being).RELNOTES=Replaced our custom
@ElementTypesAreNonnullByDefault
annotations with the JSpecify@NullMarked
annotation.