Skip to content

Commit e015172

Browse files
cpovirkGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Remove @Beta from uncontroversial Futures methods:
- `submit` - `submitAsync` - `scheduleAsync` - `nonCancellationPropagating` - `inCompletionOrder` I did also add a TODO to potentially make the return type of `scheduleAsync` more specific in the future. However, to the best of my knowledge, no one has ever asked for this. (That's not surprising: `ScheduledFuture` isn't any more useful than `Future` unless you're implementing a `ScheduledExecutorService`, and even then, access to its timeout is unavoidably racy.) Plus, should we ever need to do it, we can do it compatibly by injecting a bridge method with the old signature. (I didn't see any discussion of the return type in the API Review doc or the CL review thread. It probably just didn't come up, or maybe we all independently concluded that it wasn't worth the trouble, given that `MoreExecutors.listeningDecorator(ScheduledExecutorService)` is a bit of a pain? But I'm guessing `scheduleAsync` would be easier.) RELNOTES=`util.concurrent`: Removed `@Beta` from `Futures` methods: `submit`, `submitAsync`, `scheduleAsync`, `nonCancellationPropagating`, `inCompletionOrder`. PiperOrigin-RevId: 416139691
1 parent 9c7e13b commit e015172

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

android/guava/src/com/google/common/util/concurrent/Futures.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ private Futures() {}
179179
* @throws RejectedExecutionException if the task cannot be scheduled for execution
180180
* @since 28.2
181181
*/
182-
@Beta
183182
public static <O extends @Nullable Object> ListenableFuture<O> submit(
184183
Callable<O> callable, Executor executor) {
185184
TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable);
@@ -194,7 +193,6 @@ private Futures() {}
194193
* @throws RejectedExecutionException if the task cannot be scheduled for execution
195194
* @since 28.2
196195
*/
197-
@Beta
198196
public static ListenableFuture<@Nullable Void> submit(Runnable runnable, Executor executor) {
199197
TrustedListenableFutureTask<@Nullable Void> task =
200198
TrustedListenableFutureTask.create(runnable, null);
@@ -208,7 +206,6 @@ private Futures() {}
208206
* @throws RejectedExecutionException if the task cannot be scheduled for execution
209207
* @since 23.0
210208
*/
211-
@Beta
212209
public static <O extends @Nullable Object> ListenableFuture<O> submitAsync(
213210
AsyncCallable<O> callable, Executor executor) {
214211
TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable);
@@ -222,9 +219,9 @@ private Futures() {}
222219
* @throws RejectedExecutionException if the task cannot be scheduled for execution
223220
* @since 23.0
224221
*/
225-
@Beta
226222
@GwtIncompatible // java.util.concurrent.ScheduledExecutorService
227223
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
224+
// TODO(cpovirk): Return ListenableScheduledFuture?
228225
public static <O extends @Nullable Object> ListenableFuture<O> scheduleAsync(
229226
AsyncCallable<O> callable,
230227
long delay,
@@ -743,7 +740,6 @@ public Void call() throws Exception {
743740
*
744741
* @since 15.0
745742
*/
746-
@Beta
747743
public static <V extends @Nullable Object> ListenableFuture<V> nonCancellationPropagating(
748744
ListenableFuture<V> future) {
749745
if (future.isDone()) {
@@ -871,7 +867,6 @@ protected void afterDone() {
871867
*
872868
* @since 17.0
873869
*/
874-
@Beta
875870
public static <T extends @Nullable Object> ImmutableList<ListenableFuture<T>> inCompletionOrder(
876871
Iterable<? extends ListenableFuture<? extends T>> futures) {
877872
ListenableFuture<? extends T>[] copy = gwtCompatibleToArray(futures);

guava/src/com/google/common/util/concurrent/Futures.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ private Futures() {}
181181
* @throws RejectedExecutionException if the task cannot be scheduled for execution
182182
* @since 28.2
183183
*/
184-
@Beta
185184
public static <O extends @Nullable Object> ListenableFuture<O> submit(
186185
Callable<O> callable, Executor executor) {
187186
TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable);
@@ -196,7 +195,6 @@ private Futures() {}
196195
* @throws RejectedExecutionException if the task cannot be scheduled for execution
197196
* @since 28.2
198197
*/
199-
@Beta
200198
public static ListenableFuture<@Nullable Void> submit(Runnable runnable, Executor executor) {
201199
TrustedListenableFutureTask<@Nullable Void> task =
202200
TrustedListenableFutureTask.create(runnable, null);
@@ -210,7 +208,6 @@ private Futures() {}
210208
* @throws RejectedExecutionException if the task cannot be scheduled for execution
211209
* @since 23.0
212210
*/
213-
@Beta
214211
public static <O extends @Nullable Object> ListenableFuture<O> submitAsync(
215212
AsyncCallable<O> callable, Executor executor) {
216213
TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable);
@@ -224,8 +221,8 @@ private Futures() {}
224221
* @throws RejectedExecutionException if the task cannot be scheduled for execution
225222
* @since 28.0
226223
*/
227-
@Beta
228224
@GwtIncompatible // java.util.concurrent.ScheduledExecutorService
225+
// TODO(cpovirk): Return ListenableScheduledFuture?
229226
public static <O extends @Nullable Object> ListenableFuture<O> scheduleAsync(
230227
AsyncCallable<O> callable, Duration delay, ScheduledExecutorService executorService) {
231228
return scheduleAsync(callable, toNanosSaturated(delay), TimeUnit.NANOSECONDS, executorService);
@@ -237,9 +234,9 @@ private Futures() {}
237234
* @throws RejectedExecutionException if the task cannot be scheduled for execution
238235
* @since 23.0
239236
*/
240-
@Beta
241237
@GwtIncompatible // java.util.concurrent.ScheduledExecutorService
242238
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
239+
// TODO(cpovirk): Return ListenableScheduledFuture?
243240
public static <O extends @Nullable Object> ListenableFuture<O> scheduleAsync(
244241
AsyncCallable<O> callable,
245242
long delay,
@@ -776,7 +773,6 @@ public Void call() throws Exception {
776773
*
777774
* @since 15.0
778775
*/
779-
@Beta
780776
public static <V extends @Nullable Object> ListenableFuture<V> nonCancellationPropagating(
781777
ListenableFuture<V> future) {
782778
if (future.isDone()) {
@@ -904,7 +900,6 @@ protected void afterDone() {
904900
*
905901
* @since 17.0
906902
*/
907-
@Beta
908903
public static <T extends @Nullable Object> ImmutableList<ListenableFuture<T>> inCompletionOrder(
909904
Iterable<? extends ListenableFuture<? extends T>> futures) {
910905
ListenableFuture<? extends T>[] copy = gwtCompatibleToArray(futures);

0 commit comments

Comments
 (0)