@deprecated Provided to satisfy the {@code Function} interface; use {@link #convert} instead.
(A a)
| 445 | * @deprecated Provided to satisfy the {@code Function} interface; use {@link #convert} instead. |
| 446 | */ |
| 447 | @Deprecated |
| 448 | @Override |
| 449 | @InlineMe(replacement = "this.convert(a)") |
| 450 | public final B apply(A a) { |
| 451 | /* |
| 452 | * Given that we declare this method as accepting and returning non-nullable values (because we |
| 453 | * implement Function<A, B>, as discussed in a class-level comment), it would make some sense to |
| 454 | * perform runtime null checks on the input and output. (That would also make NullPointerTester |
| 455 | * happy!) However, since we didn't do that for many years, we're not about to start now. |
| 456 | * (Runtime checks could be particularly bad for users of LegacyConverter.) |
| 457 | * |
| 458 | * Luckily, our nullness checker is smart enough to realize that `convert` has @PolyNull-like |
| 459 | * behavior, so it knows that `convert(a)` returns a non-nullable value, and we don't need to |
| 460 | * perform even a cast, much less a runtime check. |
| 461 | * |
| 462 | * All that said, don't forget that everyone should call converter.convert() instead of |
| 463 | * converter.apply(), anyway. If clients use only converter.convert(), then their nullness |
| 464 | * checkers are unlikely to ever look at the annotations on this declaration. |
| 465 | * |
| 466 | * Historical note: At one point, we'd declared this method as accepting and returning nullable |
| 467 | * values. For details on that, see earlier revisions of this file. |
| 468 | */ |
| 469 | return convert(a); |
| 470 | } |
| 471 | |
| 472 | /** |
| 473 | * <i>May</i> return {@code true} if {@code object} is a {@code Converter} that behaves |