Skip to content

Commit 6dae21f

Browse files
committed
Remove some methods that are scheduled for removal in 23.0, along with one that was apparently scheduled for removal in 21.0.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162962688
1 parent 22da091 commit 6dae21f

File tree

12 files changed

+8
-300
lines changed

12 files changed

+8
-300
lines changed

android/guava-tests/test/com/google/common/collect/FluentIterableTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ public void testFromArrayAndIteratorRemove() {
7070
}
7171
}
7272

73-
public void testOfArrayAndIteratorRemove() {
74-
FluentIterable<TimeUnit> units = FluentIterable.of(TimeUnit.values());
75-
assertTrue(Iterables.removeIf(units, Predicates.equalTo(TimeUnit.SECONDS)));
76-
}
77-
7873
public void testFrom() {
7974
assertEquals(ImmutableList.of(1, 2, 3, 4),
8075
Lists.newArrayList(FluentIterable.from(ImmutableList.of(1, 2, 3, 4))));
@@ -91,11 +86,6 @@ public void testOf() {
9186
Lists.newArrayList(FluentIterable.of(1, 2, 3, 4)));
9287
}
9388

94-
public void testOfArray() {
95-
assertEquals(ImmutableList.of("1", "2", "3", "4"),
96-
Lists.newArrayList(FluentIterable.of(new Object[] {"1", "2", "3", "4"})));
97-
}
98-
9989
public void testFromArray() {
10090
assertEquals(ImmutableList.of("1", "2", "3", "4"),
10191
Lists.newArrayList(FluentIterable.from(new Object[] {"1", "2", "3", "4"})));

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -150,55 +150,6 @@ public void testNewProxy_badMethodWithNotEnoughTime() throws Exception {
150150
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
151151
}
152152

153-
@Deprecated
154-
public void testOldCallWithTimeout_goodCallableWithEnoughTime() throws Exception {
155-
Stopwatch stopwatch = Stopwatch.createStarted();
156-
157-
String result =
158-
service.callWithTimeout(GOOD_CALLABLE, ENOUGH_MS, MILLISECONDS, true /* interruptible */);
159-
160-
assertThat(result).isEqualTo(GOOD_CALLABLE_RESULT);
161-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
162-
}
163-
164-
@Deprecated
165-
public void testOldCallWithTimeout_goodCallableWithNotEnoughTime() throws Exception {
166-
Stopwatch stopwatch = Stopwatch.createStarted();
167-
168-
try {
169-
service.callWithTimeout(
170-
GOOD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, false /* interruptible */);
171-
fail("no exception thrown");
172-
} catch (UncheckedTimeoutException expected) {
173-
}
174-
175-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
176-
}
177-
178-
@Deprecated
179-
public void testOldCallWithTimeout_badCallableWithEnoughTime() throws Exception {
180-
Stopwatch stopwatch = Stopwatch.createStarted();
181-
try {
182-
service.callWithTimeout(BAD_CALLABLE, ENOUGH_MS, MILLISECONDS, false /* interruptible */);
183-
fail("no exception thrown");
184-
} catch (SampleException expected) {
185-
}
186-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
187-
}
188-
189-
@Deprecated
190-
public void testOldCallWithTimeout_badCallableWithNotEnoughTime() throws Exception {
191-
Stopwatch stopwatch = Stopwatch.createStarted();
192-
193-
try {
194-
service.callWithTimeout(BAD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, true /* interruptible */);
195-
fail("no exception thrown");
196-
} catch (UncheckedTimeoutException expected) {
197-
}
198-
199-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
200-
}
201-
202153
public void testCallWithTimeout_goodCallableWithEnoughTime() throws Exception {
203154
Stopwatch stopwatch = Stopwatch.createStarted();
204155

android/guava/src/com/google/common/collect/FluentIterable.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -314,24 +314,6 @@ public static <E> FluentIterable<E> of() {
314314
return FluentIterable.from(ImmutableList.<E>of());
315315
}
316316

317-
/**
318-
* Returns a fluent iterable containing {@code elements} in the specified order.
319-
*
320-
* <p>The returned iterable is modifiable, but modifications do not affect the input array.
321-
*
322-
* <p><b>{@code Stream} equivalent:</b> {@link java.util.stream.Stream#of(Object[])
323-
* Stream.of(T...)}.
324-
*
325-
* @deprecated Use {@link #from(Object[])} instead (but note the differences in mutability). This
326-
* method will be removed in Guava release 21.0.
327-
* @since 18.0
328-
*/
329-
@Beta
330-
@Deprecated
331-
public static <E> FluentIterable<E> of(E[] elements) {
332-
return from(Lists.newArrayList(elements));
333-
}
334-
335317
/**
336318
* Returns a fluent iterable containing the specified elements in order.
337319
*

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ public <T> T newProxy(
4646
return target; // ha ha
4747
}
4848

49-
@Deprecated
50-
@Override
51-
public <T> T callWithTimeout(
52-
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible)
53-
throws Exception {
54-
checkNotNull(timeoutUnit);
55-
return callable.call(); // fooled you
56-
}
57-
5849
@Override
5950
public <T> T callWithTimeout(Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit)
6051
throws ExecutionException {

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

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.common.annotations.GwtIncompatible;
2222
import com.google.common.collect.ObjectArrays;
2323
import com.google.common.collect.Sets;
24-
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2524
import java.lang.reflect.InvocationHandler;
2625
import java.lang.reflect.InvocationTargetException;
2726
import java.lang.reflect.Method;
@@ -49,40 +48,11 @@ public final class SimpleTimeLimiter implements TimeLimiter {
4948

5049
private final ExecutorService executor;
5150

52-
/**
53-
* Constructs a TimeLimiter instance using the given executor service to execute proxied method
54-
* calls.
55-
*
56-
* <p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
57-
* up, any time callers spend waiting for a thread may count toward their time limit, and in this
58-
* case the call may even time out before the target method is ever invoked.
59-
*
60-
* @param executor the ExecutorService that will execute the method calls on the target objects;
61-
* for example, a {@link Executors#newCachedThreadPool()}.
62-
* @deprecated Use {@link #create(ExecutorService)} instead. This method is scheduled to be
63-
* removed in Guava 23.0.
64-
*/
65-
@Deprecated
66-
public SimpleTimeLimiter(ExecutorService executor) {
51+
private
52+
SimpleTimeLimiter(ExecutorService executor) {
6753
this.executor = checkNotNull(executor);
6854
}
6955

70-
/**
71-
* Constructs a TimeLimiter instance using a {@link Executors#newCachedThreadPool()} to execute
72-
* proxied method calls.
73-
*
74-
* <p><b>Warning:</b> using a bounded executor may be counterproductive! If the thread pool fills
75-
* up, any time callers spend waiting for a thread may count toward their time limit, and in this
76-
* case the call may even time out before the target method is ever invoked.
77-
*
78-
* @deprecated Use {@link #create(ExecutorService)} instead with {@code
79-
* Executors.newCachedThreadPool()}. This method is scheduled to be removed in Guava 23.0.
80-
*/
81-
@Deprecated
82-
public SimpleTimeLimiter() {
83-
this(Executors.newCachedThreadPool());
84-
}
85-
8656
/**
8757
* Creates a TimeLimiter instance using the given executor service to execute method calls.
8858
*
@@ -135,11 +105,8 @@ public Object call() throws Exception {
135105
return newProxy(interfaceType, handler);
136106
}
137107

138-
// TODO: should this actually throw only ExecutionException?
139-
@Deprecated
140-
@CanIgnoreReturnValue
141-
@Override
142-
public <T> T callWithTimeout(
108+
private
109+
<T> T callWithTimeout(
143110
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible)
144111
throws Exception {
145112
checkNotNull(callable);

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import com.google.common.annotations.Beta;
1818
import com.google.common.annotations.GwtIncompatible;
19-
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2019
import java.util.concurrent.Callable;
2120
import java.util.concurrent.ExecutionException;
2221
import java.util.concurrent.TimeUnit;
@@ -76,32 +75,6 @@ public interface TimeLimiter {
7675
*/
7776
<T> T newProxy(T target, Class<T> interfaceType, long timeoutDuration, TimeUnit timeoutUnit);
7877

79-
/**
80-
* Invokes a specified Callable, timing out after the specified time limit. If the target method
81-
* call finished before the limit is reached, the return value or exception is propagated to the
82-
* caller exactly as-is. If, on the other hand, the time limit is reached, we attempt to abort the
83-
* call to the target, and throw an {@link UncheckedTimeoutException} to the caller.
84-
*
85-
* @param callable the Callable to execute
86-
* @param timeoutDuration with timeoutUnit, the maximum length of time to wait
87-
* @param timeoutUnit with timeoutDuration, the maximum length of time to wait
88-
* @param interruptible whether to respond to thread interruption by aborting the operation and
89-
* throwing InterruptedException; if false, the operation is allowed to complete or time out,
90-
* and the current thread's interrupt status is re-asserted.
91-
* @return the result returned by the Callable
92-
* @throws InterruptedException if {@code interruptible} is true and our thread is interrupted
93-
* during execution
94-
* @throws UncheckedTimeoutException if the time limit is reached
95-
* @deprecated Use one of the other {@code call[Uninterruptibly]WithTimeout()} or {@code
96-
* run[Uninterruptibly]WithTimeout()} methods. This method is scheduled to be removed in Guava
97-
* 23.0.
98-
*/
99-
@Deprecated
100-
@CanIgnoreReturnValue
101-
<T> T callWithTimeout(
102-
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit, boolean interruptible)
103-
throws Exception;
104-
10578
/**
10679
* Invokes a specified Callable, timing out after the specified time limit. If the target method
10780
* call finishes before the limit is reached, the return value or a wrapped exception is

guava-tests/test/com/google/common/collect/FluentIterableTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ public void testFromArrayAndIteratorRemove() {
7474
}
7575
}
7676

77-
public void testOfArrayAndIteratorRemove() {
78-
FluentIterable<TimeUnit> units = FluentIterable.of(TimeUnit.values());
79-
assertTrue(Iterables.removeIf(units, Predicates.equalTo(TimeUnit.SECONDS)));
80-
}
81-
8277
public void testFrom() {
8378
assertEquals(ImmutableList.of(1, 2, 3, 4),
8479
Lists.newArrayList(FluentIterable.from(ImmutableList.of(1, 2, 3, 4))));
@@ -95,11 +90,6 @@ public void testOf() {
9590
Lists.newArrayList(FluentIterable.of(1, 2, 3, 4)));
9691
}
9792

98-
public void testOfArray() {
99-
assertEquals(ImmutableList.of("1", "2", "3", "4"),
100-
Lists.newArrayList(FluentIterable.of(new Object[] {"1", "2", "3", "4"})));
101-
}
102-
10393
public void testFromArray() {
10494
assertEquals(ImmutableList.of("1", "2", "3", "4"),
10595
Lists.newArrayList(FluentIterable.from(new Object[] {"1", "2", "3", "4"})));

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -150,55 +150,6 @@ public void testNewProxy_badMethodWithNotEnoughTime() throws Exception {
150150
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
151151
}
152152

153-
@Deprecated
154-
public void testOldCallWithTimeout_goodCallableWithEnoughTime() throws Exception {
155-
Stopwatch stopwatch = Stopwatch.createStarted();
156-
157-
String result =
158-
service.callWithTimeout(GOOD_CALLABLE, ENOUGH_MS, MILLISECONDS, true /* interruptible */);
159-
160-
assertThat(result).isEqualTo(GOOD_CALLABLE_RESULT);
161-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
162-
}
163-
164-
@Deprecated
165-
public void testOldCallWithTimeout_goodCallableWithNotEnoughTime() throws Exception {
166-
Stopwatch stopwatch = Stopwatch.createStarted();
167-
168-
try {
169-
service.callWithTimeout(
170-
GOOD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, false /* interruptible */);
171-
fail("no exception thrown");
172-
} catch (UncheckedTimeoutException expected) {
173-
}
174-
175-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
176-
}
177-
178-
@Deprecated
179-
public void testOldCallWithTimeout_badCallableWithEnoughTime() throws Exception {
180-
Stopwatch stopwatch = Stopwatch.createStarted();
181-
try {
182-
service.callWithTimeout(BAD_CALLABLE, ENOUGH_MS, MILLISECONDS, false /* interruptible */);
183-
fail("no exception thrown");
184-
} catch (SampleException expected) {
185-
}
186-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS));
187-
}
188-
189-
@Deprecated
190-
public void testOldCallWithTimeout_badCallableWithNotEnoughTime() throws Exception {
191-
Stopwatch stopwatch = Stopwatch.createStarted();
192-
193-
try {
194-
service.callWithTimeout(BAD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, true /* interruptible */);
195-
fail("no exception thrown");
196-
} catch (UncheckedTimeoutException expected) {
197-
}
198-
199-
assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
200-
}
201-
202153
public void testCallWithTimeout_goodCallableWithEnoughTime() throws Exception {
203154
Stopwatch stopwatch = Stopwatch.createStarted();
204155

guava/src/com/google/common/collect/FluentIterable.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,24 +311,6 @@ public static <E> FluentIterable<E> of() {
311311
return FluentIterable.from(ImmutableList.<E>of());
312312
}
313313

314-
/**
315-
* Returns a fluent iterable containing {@code elements} in the specified order.
316-
*
317-
* <p>The returned iterable is modifiable, but modifications do not affect the input array.
318-
*
319-
* <p><b>{@code Stream} equivalent:</b> {@link java.util.stream.Stream#of(Object[])
320-
* Stream.of(T...)}.
321-
*
322-
* @deprecated Use {@link #from(Object[])} instead (but note the differences in mutability). This
323-
* method will be removed in Guava release 21.0.
324-
* @since 18.0
325-
*/
326-
@Beta
327-
@Deprecated
328-
public static <E> FluentIterable<E> of(E[] elements) {
329-
return from(Lists.newArrayList(elements));
330-
}
331-
332314
/**
333315
* Returns a fluent iterable containing the specified elements in order.
334316
*

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ public <T> T newProxy(
4646
return target; // ha ha
4747
}
4848

49-
@Deprecated
50-
@Override
51-
public <T> T callWithTimeout(
52-
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible)
53-
throws Exception {
54-
checkNotNull(timeoutUnit);
55-
return callable.call(); // fooled you
56-
}
57-
5849
@Override
5950
public <T> T callWithTimeout(Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit)
6051
throws ExecutionException {

0 commit comments

Comments
 (0)