Skip to content

Commit

Permalink
Fix comment in Converter.
Browse files Browse the repository at this point in the history
Converter.apply is annotated as returning null, so it's sound. The LegacyConverter problem arises only if users view the converter as a Function<A, B>, since Function<A, B>.apply is *not* annotated as returning null (and yet a LegacyConverter may do so, even given a non-null input).

RELNOTES=n/a
PiperOrigin-RevId: 368219982
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Apr 13, 2021
1 parent 40ea414 commit 1054847
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions android/guava/src/com/google/common/base/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ A correctedDoBackward(@CheckForNull B b) {
* methods as implementations of normal converters do?
*
* But no matter what we do, it's worth remembering that the resulting code is going to be unsound
* in the presence of LegacyConverter, at least in the case of Converter.apply and convertAll (and
* for any checkers that apply @PolyNull-like semantics to Converter.convert). So maybe we don't
* want to think too hard about how to prevent our checkers from issuing errors related to
* LegacyConverter, since it turns out that LegacyConverter does violate the assumptions we make
* elsewhere.
* in the presence of LegacyConverter, at least in the case of users who view the converter as a
* Function<A, B> or who call convertAll (and for any checkers that apply @PolyNull-like semantics
* to Converter.convert). So maybe we don't want to think too hard about how to prevent our
* checkers from issuing errors related to LegacyConverter, since it turns out that
* LegacyConverter does violate the assumptions we make elsewhere.
*/

@CheckForNull
Expand Down
10 changes: 5 additions & 5 deletions guava/src/com/google/common/base/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ A correctedDoBackward(@CheckForNull B b) {
* methods as implementations of normal converters do?
*
* But no matter what we do, it's worth remembering that the resulting code is going to be unsound
* in the presence of LegacyConverter, at least in the case of Converter.apply and convertAll (and
* for any checkers that apply @PolyNull-like semantics to Converter.convert). So maybe we don't
* want to think too hard about how to prevent our checkers from issuing errors related to
* LegacyConverter, since it turns out that LegacyConverter does violate the assumptions we make
* elsewhere.
* in the presence of LegacyConverter, at least in the case of users who view the converter as a
* Function<A, B> or who call convertAll (and for any checkers that apply @PolyNull-like semantics
* to Converter.convert). So maybe we don't want to think too hard about how to prevent our
* checkers from issuing errors related to LegacyConverter, since it turns out that
* LegacyConverter does violate the assumptions we make elsewhere.
*/

@CheckForNull
Expand Down

0 comments on commit 1054847

Please sign in to comment.