From 9c7e13b5d4446fd5d0deba9b4b8c21e6d745c11b Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 13 Dec 2021 13:36:32 -0800 Subject: [PATCH] Remove `@Beta` from the `FluentFuture` type, its factory methods, and `addCallback`. This leaves `@Beta` only for the methods that remain `@Beta` in `Futures` itself, which I'm hoping to make some effort toward later this week. This CL is an admission that we're never going to get around to reworking `FluentFuture` to be more of a "builder," as discussed in https://github.com/google/guava/issues/3419. Maybe there's still a place for something more builder-like, but there's no chance that we'll try to change `FluentFuture` in place. And probably we'll never do anything. RELNOTES=`util.concurrent`: Removed `@Beta` from the `FluentFuture` type, its factory methods, and `addCallback`. PiperOrigin-RevId: 416122526 --- .../com/google/common/util/concurrent/FluentFuture.java | 6 +++++- .../com/google/common/util/concurrent/FluentFuture.java | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/android/guava/src/com/google/common/util/concurrent/FluentFuture.java b/android/guava/src/com/google/common/util/concurrent/FluentFuture.java index 2b6ef9f557f2..683944c9e557 100644 --- a/android/guava/src/com/google/common/util/concurrent/FluentFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/FluentFuture.java @@ -70,7 +70,6 @@ * * @since 23.0 */ -@Beta @DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault @@ -184,6 +183,7 @@ public final boolean cancel(boolean mayInterruptIfRunning) { * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final FluentFuture catching( Class exceptionType, Function fallback, Executor executor) { return (FluentFuture) Futures.catching(this, exceptionType, fallback, executor); @@ -248,6 +248,7 @@ public final FluentFuture catching( * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final FluentFuture catchingAsync( Class exceptionType, AsyncFunction fallback, Executor executor) { return (FluentFuture) Futures.catchingAsync(this, exceptionType, fallback, executor); @@ -265,6 +266,7 @@ public final FluentFuture catchingAsync( */ @GwtIncompatible // ScheduledExecutorService @SuppressWarnings("GoodTime") // should accept a java.time.Duration + @Beta public final FluentFuture withTimeout( long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) { return (FluentFuture) Futures.withTimeout(this, timeout, unit, scheduledExecutor); @@ -309,6 +311,7 @@ public final FluentFuture withTimeout( * @return A future that holds result of the function (if the input succeeded) or the original * input's failure (if not) */ + @Beta public final FluentFuture transformAsync( AsyncFunction function, Executor executor) { return (FluentFuture) Futures.transformAsync(this, function, executor); @@ -346,6 +349,7 @@ public final FluentFuture withTimeout( * @param executor Executor to run the function in. * @return A future that holds result of the transformation. */ + @Beta public final FluentFuture transform( Function function, Executor executor) { return (FluentFuture) Futures.transform(this, function, executor); diff --git a/guava/src/com/google/common/util/concurrent/FluentFuture.java b/guava/src/com/google/common/util/concurrent/FluentFuture.java index 4320b78b9e97..b47e67927f08 100644 --- a/guava/src/com/google/common/util/concurrent/FluentFuture.java +++ b/guava/src/com/google/common/util/concurrent/FluentFuture.java @@ -72,7 +72,6 @@ * * @since 23.0 */ -@Beta @DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault @@ -186,6 +185,7 @@ public final boolean cancel(boolean mayInterruptIfRunning) { * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final FluentFuture catching( Class exceptionType, Function fallback, Executor executor) { return (FluentFuture) Futures.catching(this, exceptionType, fallback, executor); @@ -250,6 +250,7 @@ public final FluentFuture catching( * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final FluentFuture catchingAsync( Class exceptionType, AsyncFunction fallback, Executor executor) { return (FluentFuture) Futures.catchingAsync(this, exceptionType, fallback, executor); @@ -266,6 +267,7 @@ public final FluentFuture catchingAsync( * @since 28.0 */ @GwtIncompatible // ScheduledExecutorService + @Beta public final FluentFuture withTimeout( Duration timeout, ScheduledExecutorService scheduledExecutor) { return withTimeout(toNanosSaturated(timeout), TimeUnit.NANOSECONDS, scheduledExecutor); @@ -283,6 +285,7 @@ public final FluentFuture withTimeout( */ @GwtIncompatible // ScheduledExecutorService @SuppressWarnings("GoodTime") // should accept a java.time.Duration + @Beta public final FluentFuture withTimeout( long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) { return (FluentFuture) Futures.withTimeout(this, timeout, unit, scheduledExecutor); @@ -327,6 +330,7 @@ public final FluentFuture withTimeout( * @return A future that holds result of the function (if the input succeeded) or the original * input's failure (if not) */ + @Beta public final FluentFuture transformAsync( AsyncFunction function, Executor executor) { return (FluentFuture) Futures.transformAsync(this, function, executor); @@ -364,6 +368,7 @@ public final FluentFuture withTimeout( * @param executor Executor to run the function in. * @return A future that holds result of the transformation. */ + @Beta public final FluentFuture transform( Function function, Executor executor) { return (FluentFuture) Futures.transform(this, function, executor);