Skip to content

Commit a749ce9

Browse files
graememorgancpovirk
authored andcommitted
Replace Thread.currentThread().interrupted() with Thread.interrupted() or Thread.currentThread().interrupt(), whichever seems appropriate.
Thread.interrupted: static method on Thread which returns whether the thread has been interrupted (and resets the interrupt bit) Thread.currentThread().interrupt(): interrupts the current thread ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=301162686
1 parent d261cee commit a749ce9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

android/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void run() {
188188
// Check that this thread has been marked as interrupted again now that the thread has been
189189
// returned by SequentialExecutor. Clear the bit while checking so that the test doesn't hose
190190
// JUnit or some other test case.
191-
assertThat(Thread.currentThread().interrupted()).isTrue();
191+
assertThat(Thread.interrupted()).isTrue();
192192
}
193193

194194
public void testInterrupt_doesNotInterruptSubsequentTask() throws Exception {
@@ -215,7 +215,7 @@ public void run() {
215215
// Check that the interruption of a SequentialExecutor's task is restored to the thread once
216216
// it is yielded. Clear the bit while checking so that the test doesn't hose JUnit or some other
217217
// test case.
218-
assertThat(Thread.currentThread().interrupted()).isTrue();
218+
assertThat(Thread.interrupted()).isTrue();
219219
}
220220

221221
public void testInterrupt_doesNotStopExecution() {

guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void run() {
188188
// Check that this thread has been marked as interrupted again now that the thread has been
189189
// returned by SequentialExecutor. Clear the bit while checking so that the test doesn't hose
190190
// JUnit or some other test case.
191-
assertThat(Thread.currentThread().interrupted()).isTrue();
191+
assertThat(Thread.interrupted()).isTrue();
192192
}
193193

194194
public void testInterrupt_doesNotInterruptSubsequentTask() throws Exception {
@@ -215,7 +215,7 @@ public void run() {
215215
// Check that the interruption of a SequentialExecutor's task is restored to the thread once
216216
// it is yielded. Clear the bit while checking so that the test doesn't hose JUnit or some other
217217
// test case.
218-
assertThat(Thread.currentThread().interrupted()).isTrue();
218+
assertThat(Thread.interrupted()).isTrue();
219219
}
220220

221221
public void testInterrupt_doesNotStopExecution() {

0 commit comments

Comments
 (0)