Skip to content

Commit

Permalink
Minor clarifications after CL 423822183.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 424346757
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Jan 26, 2022
1 parent 89ad267 commit 9066755
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions android/guava/src/com/google/common/collect/ImmutableMap.java
Expand Up @@ -833,13 +833,13 @@ public final V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultVal
* pass a literal "null" should probably just use `get`, but I would expect other callers to
* pass an expression that *might* be null. This could happen with:
*
* - a `getFooOrDefault(@Nullable Foo defaultValue)` method that returns
* - a `getFooOrDefault(@CheckForNull Foo defaultValue)` method that returns
* `map.getOrDefault(FOO_KEY, defaultValue)`
*
* - a call that consults a chain of maps, as in `mapA.getOrDefault(key, mapB.getOrDefault(key,
* ...))`
*
* So it make sense for the parameter (and thus the return type) to be @Nullable.
* So it makes sense for the parameter (and thus the return type) to be @CheckForNull.
*
* Two other points:
*
Expand Down
4 changes: 2 additions & 2 deletions guava/src/com/google/common/collect/ImmutableMap.java
Expand Up @@ -976,13 +976,13 @@ public final V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultVal
* pass a literal "null" should probably just use `get`, but I would expect other callers to
* pass an expression that *might* be null. This could happen with:
*
* - a `getFooOrDefault(@Nullable Foo defaultValue)` method that returns
* - a `getFooOrDefault(@CheckForNull Foo defaultValue)` method that returns
* `map.getOrDefault(FOO_KEY, defaultValue)`
*
* - a call that consults a chain of maps, as in `mapA.getOrDefault(key, mapB.getOrDefault(key,
* ...))`
*
* So it make sense for the parameter (and thus the return type) to be @Nullable.
* So it makes sense for the parameter (and thus the return type) to be @CheckForNull.
*
* Two other points:
*
Expand Down

0 comments on commit 9066755

Please sign in to comment.