Skip to content

Commit

Permalink
Copy more @CanIgnoreReturnValue annotations to GWT emulations.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 461928636
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Jul 19, 2022
1 parent f5b5c20 commit 0bacca2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.base.Preconditions.checkArgument;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

Expand All @@ -31,6 +32,7 @@ public final class MapMaker {

public MapMaker() {}

@CanIgnoreReturnValue
public MapMaker initialCapacity(int initialCapacity) {
if (initialCapacity < 0) {
throw new IllegalArgumentException();
Expand All @@ -39,6 +41,7 @@ public MapMaker initialCapacity(int initialCapacity) {
return this;
}

@CanIgnoreReturnValue
public MapMaker concurrencyLevel(int concurrencyLevel) {
checkArgument(
concurrencyLevel >= 1, "concurrency level (%s) must be at least 1", concurrencyLevel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ public abstract class AbstractFuture<V> extends InternalFutureFailureAccess
interface Trusted<V> extends ListenableFuture<V> {}

abstract static class TrustedFuture<V> extends AbstractFuture<V> implements Trusted<V> {
@CanIgnoreReturnValue
@Override
public final V get() throws InterruptedException, ExecutionException {
return super.get();
}

@CanIgnoreReturnValue
@Override
public final V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
Expand Down Expand Up @@ -132,12 +134,14 @@ public boolean isDone() {
/*
* ForwardingFluentFuture needs to override those methods, so they are not final.
*/
@CanIgnoreReturnValue
@Override
public V get() throws InterruptedException, ExecutionException {
state.maybeThrowOnGet(throwable);
return value;
}

@CanIgnoreReturnValue
@Override
public V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
Expand Down

0 comments on commit 0bacca2

Please sign in to comment.