2525import com .google .j2objc .annotations .RetainedWith ;
2626import java .io .Serializable ;
2727import java .util .Iterator ;
28- import javax . annotation . CheckForNull ;
28+ import org . checkerframework . checker . nullness . qual . Nullable ;
2929
3030/**
3131 * A function from {@code A} to {@code B} with an associated <i>reverse</i> function from {@code B}
@@ -143,7 +143,7 @@ public abstract class Converter<A, B> implements Function<A, B> {
143143 private final boolean handleNullAutomatically ;
144144
145145 // We lazily cache the reverse view to avoid allocating on every call to reverse().
146- @ LazyInit @ RetainedWith @ CheckForNull private transient Converter <B , A > reverse ;
146+ @ LazyInit @ RetainedWith private transient @ Nullable Converter <B , A > reverse ;
147147
148148 /** Constructor for use by subclasses. */
149149 protected Converter () {
@@ -189,13 +189,11 @@ protected Converter() {
189189 *
190190 * @return the converted value; is null <i>if and only if</i> {@code a} is null
191191 */
192- @ CheckForNull
193- public final B convert (@ CheckForNull A a ) {
192+ public final @ Nullable B convert (@ Nullable A a ) {
194193 return correctedDoForward (a );
195194 }
196195
197- @ CheckForNull
198- B correctedDoForward (@ CheckForNull A a ) {
196+ @ Nullable B correctedDoForward (@ Nullable A a ) {
199197 if (handleNullAutomatically ) {
200198 // TODO(kevinb): we shouldn't be checking for a null result at runtime. Assert?
201199 return a == null ? null : checkNotNull (doForward (a ));
@@ -204,8 +202,7 @@ B correctedDoForward(@CheckForNull A a) {
204202 }
205203 }
206204
207- @ CheckForNull
208- A correctedDoBackward (@ CheckForNull B b ) {
205+ @ Nullable A correctedDoBackward (@ Nullable B b ) {
209206 if (handleNullAutomatically ) {
210207 // TODO(kevinb): we shouldn't be checking for a null result at runtime. Assert?
211208 return b == null ? null : checkNotNull (doBackward (b ));
@@ -240,13 +237,11 @@ A correctedDoBackward(@CheckForNull B b) {
240237 * LegacyConverter does violate the assumptions we make elsewhere.
241238 */
242239
243- @ CheckForNull
244- private B unsafeDoForward (@ CheckForNull A a ) {
240+ private @ Nullable B unsafeDoForward (@ Nullable A a ) {
245241 return doForward (uncheckedCastNullableTToT (a ));
246242 }
247243
248- @ CheckForNull
249- private A unsafeDoBackward (@ CheckForNull B b ) {
244+ private @ Nullable A unsafeDoBackward (@ Nullable B b ) {
250245 return doBackward (uncheckedCastNullableTToT (b ));
251246 }
252247
@@ -335,14 +330,12 @@ protected B doBackward(A a) {
335330 }
336331
337332 @ Override
338- @ CheckForNull
339- A correctedDoForward (@ CheckForNull B b ) {
333+ @ Nullable A correctedDoForward (@ Nullable B b ) {
340334 return original .correctedDoBackward (b );
341335 }
342336
343337 @ Override
344- @ CheckForNull
345- B correctedDoBackward (@ CheckForNull A a ) {
338+ @ Nullable B correctedDoBackward (@ Nullable A a ) {
346339 return original .correctedDoForward (a );
347340 }
348341
@@ -352,7 +345,7 @@ public Converter<A, B> reverse() {
352345 }
353346
354347 @ Override
355- public boolean equals (@ CheckForNull Object object ) {
348+ public boolean equals (@ Nullable Object object ) {
356349 if (object instanceof ReverseConverter ) {
357350 ReverseConverter <?, ?> that = (ReverseConverter <?, ?>) object ;
358351 return this .original .equals (that .original );
@@ -417,19 +410,17 @@ protected A doBackward(C c) {
417410 }
418411
419412 @ Override
420- @ CheckForNull
421- C correctedDoForward (@ CheckForNull A a ) {
413+ @ Nullable C correctedDoForward (@ Nullable A a ) {
422414 return second .correctedDoForward (first .correctedDoForward (a ));
423415 }
424416
425417 @ Override
426- @ CheckForNull
427- A correctedDoBackward (@ CheckForNull C c ) {
418+ @ Nullable A correctedDoBackward (@ Nullable C c ) {
428419 return first .correctedDoBackward (second .correctedDoBackward (c ));
429420 }
430421
431422 @ Override
432- public boolean equals (@ CheckForNull Object object ) {
423+ public boolean equals (@ Nullable Object object ) {
433424 if (object instanceof ConverterComposition ) {
434425 ConverterComposition <?, ?, ?> that = (ConverterComposition <?, ?, ?>) object ;
435426 return this .first .equals (that .first ) && this .second .equals (that .second );
@@ -490,7 +481,7 @@ public final B apply(A a) {
490481 * interchangeable.
491482 */
492483 @ Override
493- public boolean equals (@ CheckForNull Object object ) {
484+ public boolean equals (@ Nullable Object object ) {
494485 return super .equals (object );
495486 }
496487
@@ -539,7 +530,7 @@ protected A doBackward(B b) {
539530 }
540531
541532 @ Override
542- public boolean equals (@ CheckForNull Object object ) {
533+ public boolean equals (@ Nullable Object object ) {
543534 if (object instanceof FunctionBasedConverter ) {
544535 FunctionBasedConverter <?, ?> that = (FunctionBasedConverter <?, ?>) object ;
545536 return this .forwardFunction .equals (that .forwardFunction )
0 commit comments