guava icon indicating copy to clipboard operation
guava copied to clipboard

Remove @Beta from Futures.transform, catching, and *Async variants

Open cpovirk opened this issue 6 years ago • 3 comments

These methods are very heavily used internally. They're probably less so externally, but that may change as AndroidX exposes ListenableFuture in more APIs. Plus, Dagger Producers uses these methods.

Blockers:

  • likely change to make catching not catch the CancellationException from cancellation (internal bug 27587642)
  • possible changes to interruption behavior (https://github.com/google/guava/issues/1989)

cpovirk avatar Mar 12 '19 20:03 cpovirk

We could even try to change the parameter type to the JDK Function someday (using a trick to temporarily maintain binary compatibility), but I'm not sure we'd do it.

cpovirk avatar Jun 19 '19 21:06 cpovirk

https://github.com/google/guava/issues/3620 mentions the possibility of changing the return type of these methods (and others). But we could still do that after removing @Beta as long as we don't "just change" it: We'd have to inject bridge methods with the old signatures, as we already do for some other cases of signature changes.

cpovirk avatar Dec 13 '21 18:12 cpovirk

Anyway, my thinking lately has been that the possible interruption change doesn't necessarily block this, either, but that the possible CancellationException change for catching probably does.

I'm not entirely sure why I feel that way: Both are changes to behavior but not to mention signatures, and both are likely to have negative results for a very small percentage of callers. Maybe it's the fact that the CancellationException behavior is actually documented?

I'm going to avoid making a snap judgment after not having thought about this in a long time. But maybe I can talk myself into this. Worst case, there are a number of other methods in Futures that we probably can easily remove @Beta from.

cpovirk avatar Dec 13 '21 19:12 cpovirk

This is now fixed.

kluever avatar Apr 11 '23 18:04 kluever