Skip to content

Commit 49776fd

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
PiperOrigin-RevId: 683725351
1 parent 01e6a55 commit 49776fd

18 files changed

+26
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ protected boolean setException(Throwable throwable) {
849849
* @since 19.0
850850
*/
851851
@CanIgnoreReturnValue
852+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
852853
protected boolean setFuture(ListenableFuture<? extends V> future) {
853854
checkNotNull(future);
854855
@RetainedLocalRef Object localValue = value;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ private static final class FutureAsCancellable implements Cancellable {
458458
}
459459

460460
@Override
461+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
461462
public void cancel(boolean mayInterruptIfRunning) {
462463
delegate.cancel(mayInterruptIfRunning);
463464
}
@@ -627,6 +628,7 @@ private static final class SupplantableFuture implements Cancellable {
627628
}
628629

629630
@Override
631+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
630632
public void cancel(boolean mayInterruptIfRunning) {
631633
/*
632634
* Lock to ensure that a task cannot be rescheduled while a cancel is ongoing.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends
7676
}
7777

7878
@Override
79+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
7980
protected final void afterDone() {
8081
super.afterDone();
8182

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ public void run() {
11131113
* completed normally; {@code true} otherwise
11141114
*/
11151115
@CanIgnoreReturnValue
1116+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
11161117
public boolean cancel(boolean mayInterruptIfRunning) {
11171118
logger.get().log(FINER, "cancelling {0}", this);
11181119
boolean cancelled = future.cancel(mayInterruptIfRunning);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,7 @@ private void recordInputCompletion(
10081008
delegateIndex = delegates.size();
10091009
}
10101010

1011+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
10111012
private void recordCompletion() {
10121013
if (incompleteOutputCount.decrementAndGet() == 0 && wasCancelled) {
10131014
for (ListenableFuture<? extends T> toCancel : inputFutures) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public final void run() {
9494
}
9595
}
9696

97+
@SuppressWarnings("Interruption") // We are restoring an interrupt on this thread.
9798
private void waitForInterrupt(Thread currentThread) {
9899
/*
99100
* If someone called cancel(true), it is possible that the interrupted bit hasn't been set yet.
@@ -189,6 +190,7 @@ private void waitForInterrupt(Thread currentThread) {
189190
* Interrupts the running task. Because this internally calls {@link Thread#interrupt()} which can
190191
* in turn invoke arbitrary code it is not safe to call while holding a lock.
191192
*/
193+
@SuppressWarnings("Interruption") // We are implementing a user-requested interrupt.
192194
final void interruptTask() {
193195
// Since the Thread is replaced by DONE before run() invokes listeners or returns, if we succeed
194196
// in this CAS, there's no risk of interrupting the wrong thread or interrupting a thread that

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ protected String pendingToString() {
602602
@SuppressWarnings({
603603
"GoodTime", // should accept a java.time.Duration
604604
"CatchingUnchecked", // sneaky checked exception
605+
"Interruption", // We copy AbstractExecutorService.invokeAny. Maybe we shouldn't: b/227335009.
605606
})
606607
@J2ktIncompatible
607608
@GwtIncompatible

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
@J2ktIncompatible
5050
@GwtIncompatible
5151
@ElementTypesAreNonnullByDefault
52+
// TODO: b/227335009 - Maybe change interruption behavior, but it requires thought.
53+
@SuppressWarnings("Interruption")
5254
public final class SimpleTimeLimiter implements TimeLimiter {
5355

5456
private final ExecutorService executor;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ private static final class Fire<V extends @Nullable Object> implements Runnable
9292
}
9393

9494
@Override
95+
// TODO: b/227335009 - Maybe change interruption behavior, but it requires thought.
96+
@SuppressWarnings("Interruption")
9597
public void run() {
9698
// If either of these reads return null then we must be after a successful cancel or another
9799
// call to this method.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ protected boolean setException(Throwable throwable) {
849849
* @since 19.0
850850
*/
851851
@CanIgnoreReturnValue
852+
@SuppressWarnings("Interruption") // We are propagating an interrupt from a caller.
852853
protected boolean setFuture(ListenableFuture<? extends V> future) {
853854
checkNotNull(future);
854855
@RetainedLocalRef Object localValue = value;

0 commit comments

Comments
 (0)