Skip to content

Commit

Permalink
Make some type parameters inside ConcurrentHashMap non-null. (#70)
Browse files Browse the repository at this point in the history
We already had the parameters on the class itself correct. However, we
had declarations _inside_ incorrect. This PR fixes most but not all.

For the most part, this PR doesn't matter: Most of these APIs are not
user-visible. We had them annotated in the first place only because our
CF-stub-conversion tool changes `<T>` to `<T extends @nullable Object>`
everywhere inside `@NullMarked` code, without regard to whether the API
is publicly visible. In fairness, this makes some sense because a
non-publicly visible type can be extended by a publicly visible type,
which can render the non-publicly visible type's APIs suddenly publicly
visible. In fact, that happens in this very file: The package-private
`CollectionView` is extended by the public `KeySetView`. Still, for
_most_ of the non-visible APIs, this PR has no actual effect: It's just
a simplification (by removing information about non-visible APIs, which
we don't normally annotate) that happens to also make those APIs'
annotations more correct.

For public APIs like `KeySetView` itself, it would have made sense for
the CF stubs to have `<T extends Object>`, which would have translated
into plain `<T>` in our stubs. The PR's change to `<T>` could affect
existing callers.

I will be back with another PR that handles some other type parameters
as part of actually annotating some other unannotated APIs in the class.
  • Loading branch information
cpovirk authored Dec 19, 2024
1 parent 7630b5d commit 39339b0
Showing 1 changed file with 61 additions and 61 deletions.
Loading

0 comments on commit 39339b0

Please sign in to comment.