Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @PreferStaticImport to widely used executor factory methods. #6023

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.common.collect.Queues;
import com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.PreferStaticImport;
import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
Expand Down Expand Up @@ -365,6 +366,7 @@ private void endTask() {
*
* @since 18.0 (present as MoreExecutors.sameThreadExecutor() since 10.0)
*/
@PreferStaticImport
@GwtIncompatible // TODO
public static ListeningExecutorService newDirectExecutorService() {
return new DirectExecutorService();
Expand Down Expand Up @@ -431,6 +433,7 @@ public static ListeningExecutorService newDirectExecutorService() {
*
* @since 18.0
*/
@PreferStaticImport
public static Executor directExecutor() {
return DirectExecutor.INSTANCE;
}
Expand Down Expand Up @@ -479,6 +482,7 @@ public static Executor directExecutor() {
*
* @since 23.3 (since 23.1 as {@code sequentialExecutor})
*/
@PreferStaticImport
@GwtIncompatible
public static Executor newSequentialExecutor(Executor delegate) {
return new SequentialExecutor(delegate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.common.collect.Queues;
import com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.PreferStaticImport;
import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.lang.reflect.InvocationTargetException;
import java.time.Duration;
Expand Down Expand Up @@ -426,6 +427,7 @@ private void endTask() {
*
* @since 18.0 (present as MoreExecutors.sameThreadExecutor() since 10.0)
*/
@PreferStaticImport
@GwtIncompatible // TODO
public static ListeningExecutorService newDirectExecutorService() {
return new DirectExecutorService();
Expand Down Expand Up @@ -492,6 +494,7 @@ public static ListeningExecutorService newDirectExecutorService() {
*
* @since 18.0
*/
@PreferStaticImport
public static Executor directExecutor() {
return DirectExecutor.INSTANCE;
}
Expand Down Expand Up @@ -540,6 +543,7 @@ public static Executor directExecutor() {
*
* @since 23.3 (since 23.1 as {@code sequentialExecutor})
*/
@PreferStaticImport
@GwtIncompatible
public static Executor newSequentialExecutor(Executor delegate) {
return new SequentialExecutor(delegate);
Expand Down