From dafaa3e435421fffc7a2a2fab9c700affb07c5e4 Mon Sep 17 00:00:00 2001 From: Google Java Core Libraries Date: Tue, 15 Nov 2022 08:16:32 -0800 Subject: [PATCH] Making sameThreadScheduledExecutor's return type ListeningScheduledExecutorService, to avoid leaking a package-private class through a public method. RELNOTES=`testing`: Changed the return type of `sameThreadScheduledExecutor` to `ListeningScheduledExecutorService` to avoid leaking a package-private class through a public method. This helps Kotlin callers. PiperOrigin-RevId: 488662036 --- .../common/util/concurrent/testing/TestingExecutors.java | 4 ++-- .../common/util/concurrent/testing/TestingExecutors.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java b/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java index dc2c40d37492..38aa327c8332 100644 --- a/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java +++ b/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java @@ -88,9 +88,9 @@ public static ListeningScheduledExecutorService noOpScheduledExecutor() { * invokeAll/invokeAny} throwing RejectedExecutionException, although a subset of the tasks may * already have been executed. * - * @since 15.0 + * @since NEXT (taking the place of a method with a different return type from 15.0) */ - public static SameThreadScheduledExecutorService sameThreadScheduledExecutor() { + public static ListeningScheduledExecutorService sameThreadScheduledExecutor() { return new SameThreadScheduledExecutorService(); } diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java b/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java index dc2c40d37492..38aa327c8332 100644 --- a/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java +++ b/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java @@ -88,9 +88,9 @@ public static ListeningScheduledExecutorService noOpScheduledExecutor() { * invokeAll/invokeAny} throwing RejectedExecutionException, although a subset of the tasks may * already have been executed. * - * @since 15.0 + * @since NEXT (taking the place of a method with a different return type from 15.0) */ - public static SameThreadScheduledExecutorService sameThreadScheduledExecutor() { + public static ListeningScheduledExecutorService sameThreadScheduledExecutor() { return new SameThreadScheduledExecutorService(); }