diff --git a/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java b/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java index 2b9c51a26bdf..8f17d097c361 100644 --- a/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java +++ b/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java @@ -70,11 +70,6 @@ public void testFromArrayAndIteratorRemove() { } } - public void testOfArrayAndIteratorRemove() { - FluentIterable units = FluentIterable.of(TimeUnit.values()); - assertTrue(Iterables.removeIf(units, Predicates.equalTo(TimeUnit.SECONDS))); - } - public void testFrom() { assertEquals(ImmutableList.of(1, 2, 3, 4), Lists.newArrayList(FluentIterable.from(ImmutableList.of(1, 2, 3, 4)))); @@ -91,11 +86,6 @@ public void testOf() { Lists.newArrayList(FluentIterable.of(1, 2, 3, 4))); } - public void testOfArray() { - assertEquals(ImmutableList.of("1", "2", "3", "4"), - Lists.newArrayList(FluentIterable.of(new Object[] {"1", "2", "3", "4"}))); - } - public void testFromArray() { assertEquals(ImmutableList.of("1", "2", "3", "4"), Lists.newArrayList(FluentIterable.from(new Object[] {"1", "2", "3", "4"}))); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java b/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java index 26c11fad01ee..c0f5f4665842 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java @@ -150,55 +150,6 @@ public void testNewProxy_badMethodWithNotEnoughTime() throws Exception { assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); } - @Deprecated - public void testOldCallWithTimeout_goodCallableWithEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - - String result = - service.callWithTimeout(GOOD_CALLABLE, ENOUGH_MS, MILLISECONDS, true /* interruptible */); - - assertThat(result).isEqualTo(GOOD_CALLABLE_RESULT); - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS)); - } - - @Deprecated - public void testOldCallWithTimeout_goodCallableWithNotEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - - try { - service.callWithTimeout( - GOOD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, false /* interruptible */); - fail("no exception thrown"); - } catch (UncheckedTimeoutException expected) { - } - - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); - } - - @Deprecated - public void testOldCallWithTimeout_badCallableWithEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - try { - service.callWithTimeout(BAD_CALLABLE, ENOUGH_MS, MILLISECONDS, false /* interruptible */); - fail("no exception thrown"); - } catch (SampleException expected) { - } - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS)); - } - - @Deprecated - public void testOldCallWithTimeout_badCallableWithNotEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - - try { - service.callWithTimeout(BAD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, true /* interruptible */); - fail("no exception thrown"); - } catch (UncheckedTimeoutException expected) { - } - - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); - } - public void testCallWithTimeout_goodCallableWithEnoughTime() throws Exception { Stopwatch stopwatch = Stopwatch.createStarted(); diff --git a/android/guava/src/com/google/common/collect/FluentIterable.java b/android/guava/src/com/google/common/collect/FluentIterable.java index 52c1371978a7..ab60248026af 100644 --- a/android/guava/src/com/google/common/collect/FluentIterable.java +++ b/android/guava/src/com/google/common/collect/FluentIterable.java @@ -314,24 +314,6 @@ public static FluentIterable of() { return FluentIterable.from(ImmutableList.of()); } - /** - * Returns a fluent iterable containing {@code elements} in the specified order. - * - *

The returned iterable is modifiable, but modifications do not affect the input array. - * - *

{@code Stream} equivalent: {@link java.util.stream.Stream#of(Object[]) - * Stream.of(T...)}. - * - * @deprecated Use {@link #from(Object[])} instead (but note the differences in mutability). This - * method will be removed in Guava release 21.0. - * @since 18.0 - */ - @Beta - @Deprecated - public static FluentIterable of(E[] elements) { - return from(Lists.newArrayList(elements)); - } - /** * Returns a fluent iterable containing the specified elements in order. * diff --git a/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java index b2be54f85ed4..9dad51be2c8b 100644 --- a/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java @@ -46,15 +46,6 @@ public T newProxy( return target; // ha ha } - @Deprecated - @Override - public T callWithTimeout( - Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible) - throws Exception { - checkNotNull(timeoutUnit); - return callable.call(); // fooled you - } - @Override public T callWithTimeout(Callable callable, long timeoutDuration, TimeUnit timeoutUnit) throws ExecutionException { diff --git a/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index 917c07d7f66a..59d1e3856ac1 100644 --- a/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -21,7 +21,6 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.ObjectArrays; import com.google.common.collect.Sets; -import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -49,40 +48,11 @@ public final class SimpleTimeLimiter implements TimeLimiter { private final ExecutorService executor; - /** - * Constructs a TimeLimiter instance using the given executor service to execute proxied method - * calls. - * - *

Warning: using a bounded executor may be counterproductive! If the thread pool fills - * up, any time callers spend waiting for a thread may count toward their time limit, and in this - * case the call may even time out before the target method is ever invoked. - * - * @param executor the ExecutorService that will execute the method calls on the target objects; - * for example, a {@link Executors#newCachedThreadPool()}. - * @deprecated Use {@link #create(ExecutorService)} instead. This method is scheduled to be - * removed in Guava 23.0. - */ - @Deprecated - public SimpleTimeLimiter(ExecutorService executor) { + private + SimpleTimeLimiter(ExecutorService executor) { this.executor = checkNotNull(executor); } - /** - * Constructs a TimeLimiter instance using a {@link Executors#newCachedThreadPool()} to execute - * proxied method calls. - * - *

Warning: using a bounded executor may be counterproductive! If the thread pool fills - * up, any time callers spend waiting for a thread may count toward their time limit, and in this - * case the call may even time out before the target method is ever invoked. - * - * @deprecated Use {@link #create(ExecutorService)} instead with {@code - * Executors.newCachedThreadPool()}. This method is scheduled to be removed in Guava 23.0. - */ - @Deprecated - public SimpleTimeLimiter() { - this(Executors.newCachedThreadPool()); - } - /** * Creates a TimeLimiter instance using the given executor service to execute method calls. * @@ -135,11 +105,8 @@ public Object call() throws Exception { return newProxy(interfaceType, handler); } - // TODO: should this actually throw only ExecutionException? - @Deprecated - @CanIgnoreReturnValue - @Override - public T callWithTimeout( + private + T callWithTimeout( Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible) throws Exception { checkNotNull(callable); diff --git a/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java index f5eb8649aea8..a77b831e4099 100644 --- a/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java @@ -16,7 +16,6 @@ import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; -import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -76,32 +75,6 @@ public interface TimeLimiter { */ T newProxy(T target, Class interfaceType, long timeoutDuration, TimeUnit timeoutUnit); - /** - * Invokes a specified Callable, timing out after the specified time limit. If the target method - * call finished before the limit is reached, the return value or exception is propagated to the - * caller exactly as-is. If, on the other hand, the time limit is reached, we attempt to abort the - * call to the target, and throw an {@link UncheckedTimeoutException} to the caller. - * - * @param callable the Callable to execute - * @param timeoutDuration with timeoutUnit, the maximum length of time to wait - * @param timeoutUnit with timeoutDuration, the maximum length of time to wait - * @param interruptible whether to respond to thread interruption by aborting the operation and - * throwing InterruptedException; if false, the operation is allowed to complete or time out, - * and the current thread's interrupt status is re-asserted. - * @return the result returned by the Callable - * @throws InterruptedException if {@code interruptible} is true and our thread is interrupted - * during execution - * @throws UncheckedTimeoutException if the time limit is reached - * @deprecated Use one of the other {@code call[Uninterruptibly]WithTimeout()} or {@code - * run[Uninterruptibly]WithTimeout()} methods. This method is scheduled to be removed in Guava - * 23.0. - */ - @Deprecated - @CanIgnoreReturnValue - T callWithTimeout( - Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean interruptible) - throws Exception; - /** * Invokes a specified Callable, timing out after the specified time limit. If the target method * call finishes before the limit is reached, the return value or a wrapped exception is diff --git a/guava-tests/test/com/google/common/collect/FluentIterableTest.java b/guava-tests/test/com/google/common/collect/FluentIterableTest.java index 185150cfdeef..c37667391ea4 100644 --- a/guava-tests/test/com/google/common/collect/FluentIterableTest.java +++ b/guava-tests/test/com/google/common/collect/FluentIterableTest.java @@ -74,11 +74,6 @@ public void testFromArrayAndIteratorRemove() { } } - public void testOfArrayAndIteratorRemove() { - FluentIterable units = FluentIterable.of(TimeUnit.values()); - assertTrue(Iterables.removeIf(units, Predicates.equalTo(TimeUnit.SECONDS))); - } - public void testFrom() { assertEquals(ImmutableList.of(1, 2, 3, 4), Lists.newArrayList(FluentIterable.from(ImmutableList.of(1, 2, 3, 4)))); @@ -95,11 +90,6 @@ public void testOf() { Lists.newArrayList(FluentIterable.of(1, 2, 3, 4))); } - public void testOfArray() { - assertEquals(ImmutableList.of("1", "2", "3", "4"), - Lists.newArrayList(FluentIterable.of(new Object[] {"1", "2", "3", "4"}))); - } - public void testFromArray() { assertEquals(ImmutableList.of("1", "2", "3", "4"), Lists.newArrayList(FluentIterable.from(new Object[] {"1", "2", "3", "4"}))); diff --git a/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java b/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java index 12645622e844..26a44b77fe55 100644 --- a/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java @@ -150,55 +150,6 @@ public void testNewProxy_badMethodWithNotEnoughTime() throws Exception { assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); } - @Deprecated - public void testOldCallWithTimeout_goodCallableWithEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - - String result = - service.callWithTimeout(GOOD_CALLABLE, ENOUGH_MS, MILLISECONDS, true /* interruptible */); - - assertThat(result).isEqualTo(GOOD_CALLABLE_RESULT); - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS)); - } - - @Deprecated - public void testOldCallWithTimeout_goodCallableWithNotEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - - try { - service.callWithTimeout( - GOOD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, false /* interruptible */); - fail("no exception thrown"); - } catch (UncheckedTimeoutException expected) { - } - - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); - } - - @Deprecated - public void testOldCallWithTimeout_badCallableWithEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - try { - service.callWithTimeout(BAD_CALLABLE, ENOUGH_MS, MILLISECONDS, false /* interruptible */); - fail("no exception thrown"); - } catch (SampleException expected) { - } - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(DELAY_MS, ENOUGH_MS)); - } - - @Deprecated - public void testOldCallWithTimeout_badCallableWithNotEnoughTime() throws Exception { - Stopwatch stopwatch = Stopwatch.createStarted(); - - try { - service.callWithTimeout(BAD_CALLABLE, NOT_ENOUGH_MS, MILLISECONDS, true /* interruptible */); - fail("no exception thrown"); - } catch (UncheckedTimeoutException expected) { - } - - assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); - } - public void testCallWithTimeout_goodCallableWithEnoughTime() throws Exception { Stopwatch stopwatch = Stopwatch.createStarted(); diff --git a/guava/src/com/google/common/collect/FluentIterable.java b/guava/src/com/google/common/collect/FluentIterable.java index ecd4405a7e24..442543157c30 100644 --- a/guava/src/com/google/common/collect/FluentIterable.java +++ b/guava/src/com/google/common/collect/FluentIterable.java @@ -311,24 +311,6 @@ public static FluentIterable of() { return FluentIterable.from(ImmutableList.of()); } - /** - * Returns a fluent iterable containing {@code elements} in the specified order. - * - *

The returned iterable is modifiable, but modifications do not affect the input array. - * - *

{@code Stream} equivalent: {@link java.util.stream.Stream#of(Object[]) - * Stream.of(T...)}. - * - * @deprecated Use {@link #from(Object[])} instead (but note the differences in mutability). This - * method will be removed in Guava release 21.0. - * @since 18.0 - */ - @Beta - @Deprecated - public static FluentIterable of(E[] elements) { - return from(Lists.newArrayList(elements)); - } - /** * Returns a fluent iterable containing the specified elements in order. * diff --git a/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java b/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java index b2be54f85ed4..9dad51be2c8b 100644 --- a/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java @@ -46,15 +46,6 @@ public T newProxy( return target; // ha ha } - @Deprecated - @Override - public T callWithTimeout( - Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible) - throws Exception { - checkNotNull(timeoutUnit); - return callable.call(); // fooled you - } - @Override public T callWithTimeout(Callable callable, long timeoutDuration, TimeUnit timeoutUnit) throws ExecutionException { diff --git a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index 917c07d7f66a..59d1e3856ac1 100644 --- a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -21,7 +21,6 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.ObjectArrays; import com.google.common.collect.Sets; -import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -49,40 +48,11 @@ public final class SimpleTimeLimiter implements TimeLimiter { private final ExecutorService executor; - /** - * Constructs a TimeLimiter instance using the given executor service to execute proxied method - * calls. - * - *

Warning: using a bounded executor may be counterproductive! If the thread pool fills - * up, any time callers spend waiting for a thread may count toward their time limit, and in this - * case the call may even time out before the target method is ever invoked. - * - * @param executor the ExecutorService that will execute the method calls on the target objects; - * for example, a {@link Executors#newCachedThreadPool()}. - * @deprecated Use {@link #create(ExecutorService)} instead. This method is scheduled to be - * removed in Guava 23.0. - */ - @Deprecated - public SimpleTimeLimiter(ExecutorService executor) { + private + SimpleTimeLimiter(ExecutorService executor) { this.executor = checkNotNull(executor); } - /** - * Constructs a TimeLimiter instance using a {@link Executors#newCachedThreadPool()} to execute - * proxied method calls. - * - *

Warning: using a bounded executor may be counterproductive! If the thread pool fills - * up, any time callers spend waiting for a thread may count toward their time limit, and in this - * case the call may even time out before the target method is ever invoked. - * - * @deprecated Use {@link #create(ExecutorService)} instead with {@code - * Executors.newCachedThreadPool()}. This method is scheduled to be removed in Guava 23.0. - */ - @Deprecated - public SimpleTimeLimiter() { - this(Executors.newCachedThreadPool()); - } - /** * Creates a TimeLimiter instance using the given executor service to execute method calls. * @@ -135,11 +105,8 @@ public Object call() throws Exception { return newProxy(interfaceType, handler); } - // TODO: should this actually throw only ExecutionException? - @Deprecated - @CanIgnoreReturnValue - @Override - public T callWithTimeout( + private + T callWithTimeout( Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible) throws Exception { checkNotNull(callable); diff --git a/guava/src/com/google/common/util/concurrent/TimeLimiter.java b/guava/src/com/google/common/util/concurrent/TimeLimiter.java index f5eb8649aea8..a77b831e4099 100644 --- a/guava/src/com/google/common/util/concurrent/TimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/TimeLimiter.java @@ -16,7 +16,6 @@ import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; -import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -76,32 +75,6 @@ public interface TimeLimiter { */ T newProxy(T target, Class interfaceType, long timeoutDuration, TimeUnit timeoutUnit); - /** - * Invokes a specified Callable, timing out after the specified time limit. If the target method - * call finished before the limit is reached, the return value or exception is propagated to the - * caller exactly as-is. If, on the other hand, the time limit is reached, we attempt to abort the - * call to the target, and throw an {@link UncheckedTimeoutException} to the caller. - * - * @param callable the Callable to execute - * @param timeoutDuration with timeoutUnit, the maximum length of time to wait - * @param timeoutUnit with timeoutDuration, the maximum length of time to wait - * @param interruptible whether to respond to thread interruption by aborting the operation and - * throwing InterruptedException; if false, the operation is allowed to complete or time out, - * and the current thread's interrupt status is re-asserted. - * @return the result returned by the Callable - * @throws InterruptedException if {@code interruptible} is true and our thread is interrupted - * during execution - * @throws UncheckedTimeoutException if the time limit is reached - * @deprecated Use one of the other {@code call[Uninterruptibly]WithTimeout()} or {@code - * run[Uninterruptibly]WithTimeout()} methods. This method is scheduled to be removed in Guava - * 23.0. - */ - @Deprecated - @CanIgnoreReturnValue - T callWithTimeout( - Callable callable, long timeoutDuration, TimeUnit timeoutUnit, boolean interruptible) - throws Exception; - /** * Invokes a specified Callable, timing out after the specified time limit. If the target method * call finishes before the limit is reached, the return value or a wrapped exception is