Skip to content

Commit

Permalink
Remove @Beta from the FluentFuture type, its factory methods, and…
Browse files Browse the repository at this point in the history
… `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 #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
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Dec 13, 2021
1 parent 68500b2 commit 9c7e13b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
*
* @since 23.0
*/
@Beta
@DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture")
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
Expand Down Expand Up @@ -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 <X extends Throwable> FluentFuture<V> catching(
Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) {
return (FluentFuture<V>) Futures.catching(this, exceptionType, fallback, executor);
Expand Down Expand Up @@ -248,6 +248,7 @@ public final <X extends Throwable> FluentFuture<V> 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 <X extends Throwable> FluentFuture<V> catchingAsync(
Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) {
return (FluentFuture<V>) Futures.catchingAsync(this, exceptionType, fallback, executor);
Expand All @@ -265,6 +266,7 @@ public final <X extends Throwable> FluentFuture<V> catchingAsync(
*/
@GwtIncompatible // ScheduledExecutorService
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
@Beta
public final FluentFuture<V> withTimeout(
long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) {
return (FluentFuture<V>) Futures.withTimeout(this, timeout, unit, scheduledExecutor);
Expand Down Expand Up @@ -309,6 +311,7 @@ public final FluentFuture<V> 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 <T extends @Nullable Object> FluentFuture<T> transformAsync(
AsyncFunction<? super V, T> function, Executor executor) {
return (FluentFuture<T>) Futures.transformAsync(this, function, executor);
Expand Down Expand Up @@ -346,6 +349,7 @@ public final FluentFuture<V> withTimeout(
* @param executor Executor to run the function in.
* @return A future that holds result of the transformation.
*/
@Beta
public final <T extends @Nullable Object> FluentFuture<T> transform(
Function<? super V, T> function, Executor executor) {
return (FluentFuture<T>) Futures.transform(this, function, executor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
*
* @since 23.0
*/
@Beta
@DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture")
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
Expand Down Expand Up @@ -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 <X extends Throwable> FluentFuture<V> catching(
Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) {
return (FluentFuture<V>) Futures.catching(this, exceptionType, fallback, executor);
Expand Down Expand Up @@ -250,6 +250,7 @@ public final <X extends Throwable> FluentFuture<V> 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 <X extends Throwable> FluentFuture<V> catchingAsync(
Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) {
return (FluentFuture<V>) Futures.catchingAsync(this, exceptionType, fallback, executor);
Expand All @@ -266,6 +267,7 @@ public final <X extends Throwable> FluentFuture<V> catchingAsync(
* @since 28.0
*/
@GwtIncompatible // ScheduledExecutorService
@Beta
public final FluentFuture<V> withTimeout(
Duration timeout, ScheduledExecutorService scheduledExecutor) {
return withTimeout(toNanosSaturated(timeout), TimeUnit.NANOSECONDS, scheduledExecutor);
Expand All @@ -283,6 +285,7 @@ public final FluentFuture<V> withTimeout(
*/
@GwtIncompatible // ScheduledExecutorService
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
@Beta
public final FluentFuture<V> withTimeout(
long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) {
return (FluentFuture<V>) Futures.withTimeout(this, timeout, unit, scheduledExecutor);
Expand Down Expand Up @@ -327,6 +330,7 @@ public final FluentFuture<V> 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 <T extends @Nullable Object> FluentFuture<T> transformAsync(
AsyncFunction<? super V, T> function, Executor executor) {
return (FluentFuture<T>) Futures.transformAsync(this, function, executor);
Expand Down Expand Up @@ -364,6 +368,7 @@ public final FluentFuture<V> withTimeout(
* @param executor Executor to run the function in.
* @return A future that holds result of the transformation.
*/
@Beta
public final <T extends @Nullable Object> FluentFuture<T> transform(
Function<? super V, T> function, Executor executor) {
return (FluentFuture<T>) Futures.transform(this, function, executor);
Expand Down

0 comments on commit 9c7e13b

Please sign in to comment.