Skip to content

Commit

Permalink
Fix some Javadoc warnings, mostly around the use of the default const…
Browse files Browse the repository at this point in the history
…ructor.

RELNOTES=n/a
PiperOrigin-RevId: 698442998
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Nov 20, 2024
1 parent 3853b98 commit c799c38
Show file tree
Hide file tree
Showing 36 changed files with 100 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,6 @@ Ticker getTicker(boolean recordsTime) {
*
* @return the cache builder reference that should be used instead of {@code this} for any
* remaining configuration and cache building
* @return this {@code CacheBuilder} instance (for chaining)
* @throws IllegalStateException if a removal listener was already set
*/
public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> removalListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
@ElementTypesAreNonnullByDefault
public abstract class ForwardingSetMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends ForwardingMultimap<K, V> implements SetMultimap<K, V> {
/** Constructor for use by subclasses. */
public ForwardingSetMultimap() {}

@Override
protected abstract SetMultimap<K, V> delegate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public static <B> Builder<B> builder() {
* @since 2.0
*/
public static final class Builder<B> {
/** Creates a new builder. */
public Builder() {}

private final ImmutableMap.Builder<Class<? extends B>, B> mapBuilder = ImmutableMap.builder();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class TreeTraverser<T> {
/** Constructor for use by subclasses. */
public TreeTraverser() {}

/**
* Returns a tree traverser that uses the given function to navigate from a node to its children.
Expand Down
2 changes: 2 additions & 0 deletions android/guava/src/com/google/common/graph/AbstractGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
@Beta
@ElementTypesAreNonnullByDefault
public abstract class AbstractGraph<N> extends AbstractBaseGraph<N> implements Graph<N> {
/** Constructor for use by subclasses. */
public AbstractGraph() {}

@Override
public final boolean equals(@CheckForNull Object obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
@Beta
@ElementTypesAreNonnullByDefault
public abstract class AbstractNetwork<N, E> implements Network<N, E> {
/** Constructor for use by subclasses. */
public AbstractNetwork() {}

@Override
public Graph<N> asGraph() {
return new AbstractGraph<N>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
@ElementTypesAreNonnullByDefault
public abstract class AbstractValueGraph<N, V> extends AbstractBaseGraph<N>
implements ValueGraph<N, V> {
/** Constructor for use by subclasses. */
public AbstractValueGraph() {}

@Override
public Graph<N> asGraph() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class LinearTransformation {
/**
* Constructor for use by subclasses inside Guava.
*
* @deprecated Create instances by using the static factory methods of the class.
*/
@Deprecated
public LinearTransformation() {}

/**
* Start building an instance which maps {@code x = x1} to {@code y = y1}. Both arguments must be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class PairedStatsAccumulator {
/** Creates a new accumulator. */
public PairedStatsAccumulator() {}

// These fields must satisfy the requirements of PairedStats' constructor as well as those of the
// stat methods of this class.
Expand Down
8 changes: 8 additions & 0 deletions android/guava/src/com/google/common/math/Quantiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Quantiles {
/**
* Constructor for a type that is not meant to be instantiated.
*
* @deprecated Use the static factory methods of the class. There is no reason to create an
* instance of {@link Quantiles}.
*/
@Deprecated
public Quantiles() {}

/** Specifies the computation of a median (i.e. the 1st 2-quantile). */
public static ScaleAndIndex median() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class StatsAccumulator {
/** Creates a new accumulator. */
public StatsAccumulator() {}

// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
*/
@ElementTypesAreNonnullByDefault
public abstract class AbstractInvocationHandler implements InvocationHandler {
/** Constructor for use by subclasses. */
public AbstractInvocationHandler() {}

private static final Object[] NO_ARGS = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
@ElementTypesAreNonnullByDefault
public final class MutableTypeToInstanceMap<B extends @Nullable Object>
extends ForwardingMap<TypeToken<? extends @NonNull B>, B> implements TypeToInstanceMap<B> {
/** Creats a new map. */
public MutableTypeToInstanceMap() {}

private final Map<TypeToken<? extends @NonNull B>, B> backingMap = Maps.newHashMap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
@ElementTypesAreNonnullByDefault
public abstract class AbstractListeningExecutorService extends AbstractExecutorService
implements ListeningExecutorService {
/** Constructor for use by subclasses. */
public AbstractListeningExecutorService() {}

/**
* @since 19.0 (present with return type {@code ListenableFutureTask} since 14.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ public boolean isCancelled() {
* @since 11.0
*/
public abstract static class CustomScheduler extends Scheduler {
/** Constructor for use by subclasses. */
public CustomScheduler() {}

/** A callable class that can reschedule itself using a {@link CustomScheduler}. */
private final class ReschedulableCallable implements Callable<@Nullable Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class FakeTimeLimiter implements TimeLimiter {
/** Creates a new {@link FakeTimeLimiter}. */
public FakeTimeLimiter() {}

@CanIgnoreReturnValue // TODO(kak): consider removing this
@Override
public <T> T newProxy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ enum State {
* @since 15.0 (present as an interface in 13.0)
*/
abstract class Listener {
/** Constructor for use by subclasses. */
public Listener() {}

/**
* Called when the service transitions from {@linkplain State#NEW NEW} to {@linkplain
* State#STARTING STARTING}. This occurs when {@link Service#startAsync} is called the first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public String toString() {
* @since 15.0 (present as an interface in 14.0)
*/
public abstract static class Listener {
/** Constructor for use by subclasses. */
public Listener() {}

/**
* Called when the service initially becomes healthy.
*
Expand Down
1 change: 0 additions & 1 deletion guava/src/com/google/common/cache/CacheBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,6 @@ Ticker getTicker(boolean recordsTime) {
*
* @return the cache builder reference that should be used instead of {@code this} for any
* remaining configuration and cache building
* @return this {@code CacheBuilder} instance (for chaining)
* @throws IllegalStateException if a removal listener was already set
*/
public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> removalListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
@ElementTypesAreNonnullByDefault
public abstract class ForwardingSetMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends ForwardingMultimap<K, V> implements SetMultimap<K, V> {
/** Constructor for use by subclasses. */
public ForwardingSetMultimap() {}

@Override
protected abstract SetMultimap<K, V> delegate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public static <B> Builder<B> builder() {
* @since 2.0
*/
public static final class Builder<B> {
/** Creates a new builder. */
public Builder() {}

private final ImmutableMap.Builder<Class<? extends B>, B> mapBuilder = ImmutableMap.builder();

/**
Expand Down
2 changes: 2 additions & 0 deletions guava/src/com/google/common/collect/TreeTraverser.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class TreeTraverser<T> {
/** Constructor for use by subclasses. */
public TreeTraverser() {}

/**
* Returns a tree traverser that uses the given function to navigate from a node to its children.
Expand Down
2 changes: 2 additions & 0 deletions guava/src/com/google/common/graph/AbstractGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
@Beta
@ElementTypesAreNonnullByDefault
public abstract class AbstractGraph<N> extends AbstractBaseGraph<N> implements Graph<N> {
/** Constructor for use by subclasses. */
public AbstractGraph() {}

@Override
public final boolean equals(@CheckForNull Object obj) {
Expand Down
3 changes: 3 additions & 0 deletions guava/src/com/google/common/graph/AbstractNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
@Beta
@ElementTypesAreNonnullByDefault
public abstract class AbstractNetwork<N, E> implements Network<N, E> {
/** Constructor for use by subclasses. */
public AbstractNetwork() {}

@Override
public Graph<N> asGraph() {
return new AbstractGraph<N>() {
Expand Down
2 changes: 2 additions & 0 deletions guava/src/com/google/common/graph/AbstractValueGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
@ElementTypesAreNonnullByDefault
public abstract class AbstractValueGraph<N, V> extends AbstractBaseGraph<N>
implements ValueGraph<N, V> {
/** Constructor for use by subclasses. */
public AbstractValueGraph() {}

@Override
public Graph<N> asGraph() {
Expand Down
7 changes: 7 additions & 0 deletions guava/src/com/google/common/math/LinearTransformation.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class LinearTransformation {
/**
* Constructor for use by subclasses inside Guava.
*
* @deprecated Create instances by using the static factory methods of the class.
*/
@Deprecated
public LinearTransformation() {}

/**
* Start building an instance which maps {@code x = x1} to {@code y = y1}. Both arguments must be
Expand Down
2 changes: 2 additions & 0 deletions guava/src/com/google/common/math/PairedStatsAccumulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class PairedStatsAccumulator {
/** Creates a new accumulator. */
public PairedStatsAccumulator() {}

// These fields must satisfy the requirements of PairedStats' constructor as well as those of the
// stat methods of this class.
Expand Down
8 changes: 8 additions & 0 deletions guava/src/com/google/common/math/Quantiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Quantiles {
/**
* Constructor for a type that is not meant to be instantiated.
*
* @deprecated Use the static factory methods of the class. There is no reason to create an
* instance of {@link Quantiles}.
*/
@Deprecated
public Quantiles() {}

/** Specifies the computation of a median (i.e. the 1st 2-quantile). */
public static ScaleAndIndex median() {
Expand Down
2 changes: 2 additions & 0 deletions guava/src/com/google/common/math/StatsAccumulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class StatsAccumulator {
/** Creates a new accumulator. */
public StatsAccumulator() {}

// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
*/
@ElementTypesAreNonnullByDefault
public abstract class AbstractInvocationHandler implements InvocationHandler {
/** Constructor for use by subclasses. */
public AbstractInvocationHandler() {}

private static final Object[] NO_ARGS = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
@ElementTypesAreNonnullByDefault
public final class MutableTypeToInstanceMap<B extends @Nullable Object>
extends ForwardingMap<TypeToken<? extends @NonNull B>, B> implements TypeToInstanceMap<B> {
/** Creats a new map. */
public MutableTypeToInstanceMap() {}

private final Map<TypeToken<? extends @NonNull B>, B> backingMap = Maps.newHashMap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
@ElementTypesAreNonnullByDefault
public abstract class AbstractListeningExecutorService extends AbstractExecutorService
implements ListeningExecutorService {
/** Constructor for use by subclasses. */
public AbstractListeningExecutorService() {}

/**
* @since 19.0 (present with return type {@code ListenableFutureTask} since 14.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ public boolean isCancelled() {
* @since 11.0
*/
public abstract static class CustomScheduler extends Scheduler {
/** Constructor for use by subclasses. */
public CustomScheduler() {}

/** A callable class that can reschedule itself using a {@link CustomScheduler}. */
private final class ReschedulableCallable implements Callable<@Nullable Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class FakeTimeLimiter implements TimeLimiter {
/** Creates a new {@link FakeTimeLimiter}. */
public FakeTimeLimiter() {}

@CanIgnoreReturnValue // TODO(kak): consider removing this
@Override
public <T> T newProxy(
Expand Down
3 changes: 3 additions & 0 deletions guava/src/com/google/common/util/concurrent/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ enum State {
* @since 15.0 (present as an interface in 13.0)
*/
abstract class Listener {
/** Constructor for use by subclasses. */
public Listener() {}

/**
* Called when the service transitions from {@linkplain State#NEW NEW} to {@linkplain
* State#STARTING STARTING}. This occurs when {@link Service#startAsync} is called the first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public String toString() {
* @since 15.0 (present as an interface in 14.0)
*/
public abstract static class Listener {
/** Constructor for use by subclasses. */
public Listener() {}

/**
* Called when the service initially becomes healthy.
*
Expand Down

0 comments on commit c799c38

Please sign in to comment.