Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public int compare(Invokable<?, ?> left, Invokable<?, ?> right) {
private final ListMultimap<Class<?>, Object> distinctValues = ArrayListMultimap.create();
private final NullPointerTester nullPointerTester = new NullPointerTester();

/** Constructs a new {@code ClassSanityTester}. */
public ClassSanityTester() {
// TODO(benyu): bake these into ArbitraryInstances.
setDefault(byte.class, (byte) 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public EquivalenceTester<T> addEquivalenceGroup(T first, T... rest) {
return this;
}

/**
* Adds a group of objects that are supposed to be equivalent to each other and not equivalent to
* objects in any other equivalence group added to this tester.
*/
@CanIgnoreReturnValue
public EquivalenceTester<T> addEquivalenceGroup(Iterable<T> group) {
delegate.addRelatedGroup(group);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,6 @@ public String toString() {
}
}

/** Constructs a new {@code ForwardingWrapperTester}. */
public ForwardingWrapperTester() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private static void createUnreachableLatchFinalizer(CountDownLatch latch) {
*/
@DoNotMock("Implement with a lambda")
public interface FinalizationPredicate {
/** Returns {@code true} if the finalization condition is met. */
boolean isDone();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public final class NullPointerTester {
* NullPointerTester. But if you are a user who is reading this because this change caused you
* trouble, please let us know: https://github.com/google/guava/issues/new
*/
/** Constructs a new {@code NullPointerTester}. */
@IgnoreJRERequirement
public NullPointerTester() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ public final void tearDown() {
}
}

/** Performs the actual teardown. Exceptions thrown by this method will be caught and logged. */
public abstract void sloppyTearDown() throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,24 @@ public class TearDownStack implements TearDownAccepter {
@GuardedBy("lock")
final Deque<TearDown> stack = new ArrayDeque<>();

/*
* TODO(cpovirk): Rework the "suppress" terminology in this class for Java's "new" concept of
* "suppressed exceptions." At the moment, we use addSuppressed only if suppressThrows is *false*!
*/

private final boolean suppressThrows;

/**
* Constructs a new {@code TearDownStack} that does not suppress exceptions throw during teardown.
*/
public TearDownStack() {
this.suppressThrows = false;
}

/**
* Constructs a new {@code TearDownStack}, specifying whether to suppress exceptions thrown during
* teardown.
*/
public TearDownStack(boolean suppressThrows) {
this.suppressThrows = suppressThrows;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void flush() {}
@Override
public void close() {}

/** Clears all stored log records. */
public void clear() {
synchronized (lock) {
list.clear();
Expand Down
12 changes: 12 additions & 0 deletions android/guava/src/com/google/common/base/CommonMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,27 @@
*/
@GwtCompatible
abstract class CommonMatcher {
/** Returns {@code true} if the entire input region matches the pattern. */
public abstract boolean matches();

/** Attempts to find the next subsequence of the input sequence that matches the pattern. */
public abstract boolean find();

/**
* Resets this matcher and then attempts to find the next subsequence of the input sequence that
* matches the pattern, starting at the specified index.
*/
public abstract boolean find(int index);

/**
* Replaces every subsequence of the input sequence that matches the pattern with the given
* replacement string.
*/
public abstract String replaceAll(String replacement);

/** Returns the offset after the last character matched. */
public abstract int end();

/** Returns the start index of the previous match. */
public abstract int start();
}
3 changes: 3 additions & 0 deletions android/guava/src/com/google/common/base/CommonPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@
*/
@GwtCompatible
abstract class CommonPattern {
/** Returns a {@link CommonMatcher} for the given input. */
public abstract CommonMatcher matcher(CharSequence t);

/** Returns the pattern string. */
public abstract String pattern();

/** Returns the flags used to compile this pattern. */
public abstract int flags();

// Re-declare this as abstract to force subclasses to override.
Expand Down
4 changes: 3 additions & 1 deletion android/guava/src/com/google/common/cache/CacheLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.Executor;
import org.jspecify.annotations.Nullable;

/**
* Computes or retrieves values, based on a key, for use in populating a {@link LoadingCache}.
Expand Down Expand Up @@ -243,7 +244,8 @@ public static final class UnsupportedLoadingOperationException
* @since 11.0
*/
public static final class InvalidCacheLoadException extends RuntimeException {
public InvalidCacheLoadException(String message) {
/** Constructs a new {@code InvalidCacheLoadException} with the specified detail message. */
public InvalidCacheLoadException(@Nullable String message) {
super(message);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public void cleanUp() {
public abstract static class SimpleForwardingCache<K, V> extends ForwardingCache<K, V> {
private final Cache<K, V> delegate;

/** Constructor for use by subclasses. */
protected SimpleForwardingCache(Cache<K, V> delegate) {
this.delegate = Preconditions.checkNotNull(delegate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public abstract static class SimpleForwardingLoadingCache<K, V>
extends ForwardingLoadingCache<K, V> {
private final LoadingCache<K, V> delegate;

/** Constructor for use by subclasses. */
protected SimpleForwardingLoadingCache(LoadingCache<K, V> delegate) {
this.delegate = Preconditions.checkNotNull(delegate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static <K extends Comparable<?>, V> Builder<K, V> builder() {
public static final class Builder<K extends Comparable<?>, V> {
private final List<Entry<Range<K>, V>> entries;

/** Constructs a new builder. */
public Builder() {
this.entries = new ArrayList<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ public static <C extends Comparable<?>> Builder<C> builder() {
public static class Builder<C extends Comparable<?>> {
private final List<Range<C>> ranges;

/** Constructs a new builder. */
public Builder() {
this.ranges = new ArrayList<>();
}
Expand Down
1 change: 1 addition & 0 deletions android/guava/src/com/google/common/collect/Interners.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public InternerBuilder concurrencyLevel(int concurrencyLevel) {
return this;
}

/** Builds and returns a new interner. */
public <E> Interner<E> build() {
if (!strong) {
mapMaker.weakKeys();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@IgnoreJRERequirement
public final class InsecureRecursiveDeleteException extends FileSystemException {

/** Constructs a new {@code InsecureRecursiveDeleteException} for the specified file. */
public InsecureRecursiveDeleteException(@Nullable String file) {
super(file, null, "unable to guarantee security of recursive delete");
}
Expand Down
15 changes: 15 additions & 0 deletions android/guava/src/com/google/common/net/HttpHeaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,28 @@ private HttpHeaders() {}
public static final class ReferrerPolicyValues {
private ReferrerPolicyValues() {}

/** The {@code no-referrer} referrer policy. */
public static final String NO_REFERRER = "no-referrer";

/** The {@code no-referrer-when-downgrade} referrer policy. */
public static final String NO_REFFERER_WHEN_DOWNGRADE = "no-referrer-when-downgrade";

/** The {@code same-origin} referrer policy. */
public static final String SAME_ORIGIN = "same-origin";

/** The {@code origin} referrer policy. */
public static final String ORIGIN = "origin";

/** The {@code strict-origin} referrer policy. */
public static final String STRICT_ORIGIN = "strict-origin";

/** The {@code origin-when-cross-origin} referrer policy. */
public static final String ORIGIN_WHEN_CROSS_ORIGIN = "origin-when-cross-origin";

/** The {@code strict-origin-when-cross-origin} referrer policy. */
public static final String STRICT_ORIGIN_WHEN_CROSS_ORIGIN = "strict-origin-when-cross-origin";

/** The {@code unsafe-url} referrer policy. */
public static final String UNSAFE_URL = "unsafe-url";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@
*/
@GwtCompatible
public final class UnsignedInteger extends Number implements Comparable<UnsignedInteger> {
/** An {@code UnsignedInteger} constant holding the value 0. */
public static final UnsignedInteger ZERO = fromIntBits(0);

/** An {@code UnsignedInteger} constant holding the value 1. */
public static final UnsignedInteger ONE = fromIntBits(1);

/** An {@code UnsignedInteger} constant holding the maximum value, 2^32 - 1. */
public static final UnsignedInteger MAX_VALUE = fromIntBits(-1);

private final int value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ public final class UnsignedLong extends Number implements Comparable<UnsignedLon

private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;

/** An {@code UnsignedLong} constant holding the value 0. */
public static final UnsignedLong ZERO = new UnsignedLong(0);

/** An {@code UnsignedLong} constant holding the value 1. */
public static final UnsignedLong ONE = new UnsignedLong(1);

/** An {@code UnsignedLong} constant holding the maximum value, 2^64 - 1. */
public static final UnsignedLong MAX_VALUE = new UnsignedLong(-1L);

private final long value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
public final class UnsignedLongs {
private UnsignedLongs() {}

public static final long MAX_VALUE = -1L; // Equivalent to 2^64 - 1
/** A constant holding the maximum value an unsigned {@code long} can have, 2^64 - 1. */
public static final long MAX_VALUE = -1L;

/**
* A (self-inverse) bijection which converts the ordering on unsigned longs to the ordering on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public abstract class TypeParameter<T> extends TypeCapture<T> {

final TypeVariable<?> typeVariable;

/** Constructor for use by subclasses. */
protected TypeParameter() {
Type type = capture();
checkArgument(type instanceof TypeVariable, "%s should be a type variable.", type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public final class TypeResolver {

private final TypeTable typeTable;

/** Constructs a new {@code TypeResolver} with no type mappings. */
public TypeResolver() {
this.typeTable = new TypeTable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public abstract static class SimpleForwardingFuture<V extends @Nullable Object>
extends ForwardingFuture<V> {
private final Future<V> delegate;

/** Constructor for use by subclasses. */
protected SimpleForwardingFuture(Future<V> delegate) {
this.delegate = Preconditions.checkNotNull(delegate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public abstract static class SimpleForwardingListenableFuture<V extends @Nullabl
extends ForwardingListenableFuture<V> {
private final ListenableFuture<V> delegate;

/** Constructor for use by subclasses. */
protected SimpleForwardingListenableFuture(ListenableFuture<V> delegate) {
this.delegate = Preconditions.checkNotNull(delegate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@ public void run() {
}
}

/** Constructs a new {@code ListenerCallQueue}. */
ListenerCallQueue() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@
@J2ktIncompatible
@GwtIncompatible
public class UncheckedTimeoutException extends RuntimeException {
/** Constructs a new {@code UncheckedTimeoutException} with {@code null} as its detail message. */
public UncheckedTimeoutException() {}

/** Constructs a new {@code UncheckedTimeoutException} with the specified detail message. */
public UncheckedTimeoutException(@Nullable String message) {
super(message);
}

/** Constructs a new {@code UncheckedTimeoutException} with the specified cause. */
public UncheckedTimeoutException(@Nullable Throwable cause) {
super(cause);
}

/**
* Constructs a new {@code UncheckedTimeoutException} with the specified detail message and cause.
*/
public UncheckedTimeoutException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
abstract class WrappingExecutorService implements ExecutorService {
private final ExecutorService delegate;

/** Constructor for use by subclasses. */
protected WrappingExecutorService(ExecutorService delegate) {
this.delegate = checkNotNull(delegate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ abstract class WrappingScheduledExecutorService extends WrappingExecutorService
implements ScheduledExecutorService {
final ScheduledExecutorService delegate;

/** Constructor for use by subclasses. */
protected WrappingScheduledExecutorService(ScheduledExecutorService delegate) {
super(delegate);
this.delegate = delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public int compare(Invokable<?, ?> left, Invokable<?, ?> right) {
private final ListMultimap<Class<?>, Object> distinctValues = ArrayListMultimap.create();
private final NullPointerTester nullPointerTester = new NullPointerTester();

/** Constructs a new {@code ClassSanityTester}. */
public ClassSanityTester() {
// TODO(benyu): bake these into ArbitraryInstances.
setDefault(byte.class, (byte) 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public EquivalenceTester<T> addEquivalenceGroup(T first, T... rest) {
return this;
}

/**
* Adds a group of objects that are supposed to be equivalent to each other and not equivalent to
* objects in any other equivalence group added to this tester.
*/
@CanIgnoreReturnValue
public EquivalenceTester<T> addEquivalenceGroup(Iterable<T> group) {
delegate.addRelatedGroup(group);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,6 @@ public String toString() {
}
}

/** Constructs a new {@code ForwardingWrapperTester}. */
public ForwardingWrapperTester() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private static void createUnreachableLatchFinalizer(CountDownLatch latch) {
*/
@DoNotMock("Implement with a lambda")
public interface FinalizationPredicate {
/** Returns {@code true} if the finalization condition is met. */
boolean isDone();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public final class NullPointerTester {
* NullPointerTester. But if you are a user who is reading this because this change caused you
* trouble, please let us know: https://github.com/google/guava/issues/new
*/
/** Constructs a new {@code NullPointerTester}. */
@IgnoreJRERequirement
public NullPointerTester() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ public final void tearDown() {
}
}

/** Performs the actual teardown. Exceptions thrown by this method will be caught and logged. */
public abstract void sloppyTearDown() throws Exception;
}
Loading
Loading