Skip to content

Commit

Permalink
Remove some redundancies.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 720963735
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Jan 30, 2025
1 parent 83692e7 commit 7a0f11c
Show file tree
Hide file tree
Showing 41 changed files with 67 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> getInnerGenerator()

public static class MapSortedKeySetGenerator<
K extends @Nullable Object, V extends @Nullable Object>
extends MapKeySetGenerator<K, V> implements TestSortedSetGenerator<K>, DerivedGenerator {
extends MapKeySetGenerator<K, V> implements TestSortedSetGenerator<K> {
private final TestSortedMapGenerator<K, V> delegate;

public MapSortedKeySetGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public Set<Feature<? super Map>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract MapFeature[] value() default {};
MapFeature[] value() default {};

public abstract MapFeature[] absent() default {};
MapFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public Set<Feature<? super Set>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract SetFeature[] value() default {};
SetFeature[] value() default {};

public abstract SetFeature[] absent() default {};
SetFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public Set<Feature<? super Multimap>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract MultimapFeature[] value() default {};
MultimapFeature[] value() default {};

public abstract MultimapFeature[] absent() default {};
MultimapFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public Set<Feature<? super Multiset>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract MultisetFeature[] value() default {};
MultisetFeature[] value() default {};

public abstract MultisetFeature[] absent() default {};
MultisetFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import com.google.common.collect.Ordering;
import com.google.common.collect.Range;
import com.google.common.collect.Sets;
import com.google.common.collect.testing.TestCollectionGenerator;
import com.google.common.collect.testing.TestCollidingSetGenerator;
import com.google.common.collect.testing.TestIntegerSortedSetGenerator;
import com.google.common.collect.testing.TestSetGenerator;
Expand Down Expand Up @@ -120,11 +119,7 @@ protected Set<String> create(String[] elements) {
}
}

public static class ImmutableSetWithBadHashesGenerator extends TestCollidingSetGenerator
// Work around a GWT compiler bug. Not explicitly listing this will
// cause the createArray() method missing in the generated javascript.
// TODO: Remove this once the GWT bug is fixed.
implements TestCollectionGenerator<Object> {
public static class ImmutableSetWithBadHashesGenerator extends TestCollidingSetGenerator {
@Override
public Set<Object> create(Object... elements) {
return ImmutableSet.copyOf(elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public enum ListSizeDistribution {
final int min;
final int max;

private ListSizeDistribution(int min, int max) {
ListSizeDistribution(int min, int max) {
this.min = min;
this.max = max;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum HashFunctionEnum {

private final HashFunction hashFunction;

private HashFunctionEnum(HashFunction hashFunction) {
HashFunctionEnum(HashFunction hashFunction) {
this.hashFunction = hashFunction;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ public interface SourceSinkFactory<S, T> {
T getExpected(T data);

/** Cleans up anything created when creating the source or sink. */
public abstract void tearDown() throws IOException;
void tearDown() throws IOException;

/** Factory for byte or char sources. */
public interface SourceFactory<S, T> extends SourceSinkFactory<S, T> {
interface SourceFactory<S, T> extends SourceSinkFactory<S, T> {

/** Creates a new source containing some or all of the given data. */
S createSource(T data) throws IOException;
}

/** Factory for byte or char sinks. */
public interface SinkFactory<S, T> extends SourceSinkFactory<S, T> {
interface SinkFactory<S, T> extends SourceSinkFactory<S, T> {

/** Creates a new sink. */
S createSink() throws IOException;
Expand All @@ -66,14 +66,14 @@ public interface SinkFactory<S, T> extends SourceSinkFactory<S, T> {
}

/** Factory for {@link ByteSource} instances. */
public interface ByteSourceFactory extends SourceFactory<ByteSource, byte[]> {}
interface ByteSourceFactory extends SourceFactory<ByteSource, byte[]> {}

/** Factory for {@link ByteSink} instances. */
public interface ByteSinkFactory extends SinkFactory<ByteSink, byte[]> {}
interface ByteSinkFactory extends SinkFactory<ByteSink, byte[]> {}

/** Factory for {@link CharSource} instances. */
public interface CharSourceFactory extends SourceFactory<CharSource, String> {}
interface CharSourceFactory extends SourceFactory<CharSource, String> {}

/** Factory for {@link CharSink} instances. */
public interface CharSinkFactory extends SinkFactory<CharSink, String> {}
interface CharSinkFactory extends SinkFactory<CharSink, String> {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private boolean complete(@Nullable V v, @Nullable Throwable t, int finalState) {
}
}

static final CancellationException cancellationExceptionWithCause(
static CancellationException cancellationExceptionWithCause(
@Nullable String message, @Nullable Throwable cause) {
CancellationException exception = new CancellationException(message);
exception.initCause(cause);
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/cache/LocalCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -4609,7 +4609,7 @@ protected Cache<K, V> delegate() {
* the proxy must be able to behave as the cache itself.
*/
static final class LoadingSerializationProxy<K, V> extends ManualSerializationProxy<K, V>
implements LoadingCache<K, V>, Serializable {
implements LoadingCache<K, V> {
private static final long serialVersionUID = 1;

transient @Nullable LoadingCache<K, V> autoDelegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ class CompactLinkedHashSet<E extends @Nullable Object> extends CompactHashSet<E>
/** Pointer to the last node in the linked list, or {@code ENDPOINT} if there are no entries. */
private transient int lastEntry;

CompactLinkedHashSet() {
super();
}
CompactLinkedHashSet() {}

CompactLinkedHashSet(int expectedSize) {
super(expectedSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ public static final class Builder<K, V> extends ImmutableMultimap.Builder<K, V>
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
* ImmutableSetMultimap#builder}.
*/
public Builder() {
super();
}
public Builder() {}

Builder(int expectedKeys) {
super(expectedKeys);
Expand Down
6 changes: 3 additions & 3 deletions android/guava/src/com/google/common/collect/Streams.java
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public boolean tryAdvance(Consumer<? super R> action) {
.onClose(stream::close);
}
class Splitr extends MapWithIndexSpliterator<Spliterator.OfInt, R, Splitr>
implements IntConsumer, Spliterator<R> {
implements IntConsumer {
int holder;

Splitr(Spliterator.OfInt splitr, long index) {
Expand Down Expand Up @@ -640,7 +640,7 @@ public boolean tryAdvance(Consumer<? super R> action) {
.onClose(stream::close);
}
class Splitr extends MapWithIndexSpliterator<Spliterator.OfLong, R, Splitr>
implements LongConsumer, Spliterator<R> {
implements LongConsumer {
long holder;

Splitr(Spliterator.OfLong splitr, long index) {
Expand Down Expand Up @@ -720,7 +720,7 @@ public boolean tryAdvance(Consumer<? super R> action) {
.onClose(stream::close);
}
class Splitr extends MapWithIndexSpliterator<Spliterator.OfDouble, R, Splitr>
implements DoubleConsumer, Spliterator<R> {
implements DoubleConsumer {
double holder;

Splitr(Spliterator.OfDouble splitr, long index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ public SortedMap<K, V> tailMap(K fromKey) {
}

static final class SynchronizedBiMap<K extends @Nullable Object, V extends @Nullable Object>
extends SynchronizedMap<K, V> implements BiMap<K, V>, Serializable {
extends SynchronizedMap<K, V> implements BiMap<K, V> {
private transient @Nullable Set<V> valueSet;
@RetainedWith private transient @Nullable BiMap<V, K> inverse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class InvalidatableSet<E> extends ForwardingSet<E> {
private final Set<E> delegate;
private final Supplier<String> errorMessage;

public static final <E> InvalidatableSet<E> of(
static <E> InvalidatableSet<E> of(
Set<E> delegate, Supplier<Boolean> validator, Supplier<String> errorMessage) {
return new InvalidatableSet<>(
checkNotNull(delegate), checkNotNull(validator), checkNotNull(errorMessage));
Expand Down
4 changes: 2 additions & 2 deletions android/guava/src/com/google/common/hash/Funnels.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static Funnel<CharSequence> stringFunnel(Charset charset) {
return new StringCharsetFunnel(charset);
}

private static class StringCharsetFunnel implements Funnel<CharSequence>, Serializable {
private static class StringCharsetFunnel implements Funnel<CharSequence> {
private final Charset charset;

StringCharsetFunnel(Charset charset) {
Expand Down Expand Up @@ -176,7 +176,7 @@ public String toString() {
}

private static class SequentialFunnel<E extends @Nullable Object>
implements Funnel<Iterable<? extends E>>, Serializable {
implements Funnel<Iterable<? extends E>> {
private final Funnel<E> elementFunnel;

SequentialFunnel(Funnel<E> elementFunnel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.google.common.annotations.GwtCompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.Serializable;
import java.math.BigInteger;
import org.jspecify.annotations.Nullable;

Expand All @@ -38,7 +37,7 @@
* @since 11.0
*/
@GwtCompatible(serializable = true)
public final class UnsignedLong extends Number implements Comparable<UnsignedLong>, Serializable {
public final class UnsignedLong extends Number implements Comparable<UnsignedLong> {

private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLong;

/**
Expand Down Expand Up @@ -53,7 +52,7 @@
* @author Martin Buchholz
* @since 11.0
*/
public class AtomicDouble extends Number implements Serializable {
public class AtomicDouble extends Number {
private static final long serialVersionUID = 0L;

// We would use AtomicLongFieldUpdater, but it has issues on some Android devices.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> getInnerGenerator()

public static class MapSortedKeySetGenerator<
K extends @Nullable Object, V extends @Nullable Object>
extends MapKeySetGenerator<K, V> implements TestSortedSetGenerator<K>, DerivedGenerator {
extends MapKeySetGenerator<K, V> implements TestSortedSetGenerator<K> {
private final TestSortedMapGenerator<K, V> delegate;

public MapSortedKeySetGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public Set<Feature<? super Map>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract MapFeature[] value() default {};
MapFeature[] value() default {};

public abstract MapFeature[] absent() default {};
MapFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public Set<Feature<? super Set>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract SetFeature[] value() default {};
SetFeature[] value() default {};

public abstract SetFeature[] absent() default {};
SetFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public Set<Feature<? super Multimap>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract MultimapFeature[] value() default {};
MultimapFeature[] value() default {};

public abstract MultimapFeature[] absent() default {};
MultimapFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public Set<Feature<? super Multiset>> getImpliedFeatures() {
@Inherited
@TesterAnnotation
public @interface Require {
public abstract MultisetFeature[] value() default {};
MultisetFeature[] value() default {};

public abstract MultisetFeature[] absent() default {};
MultisetFeature[] absent() default {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import com.google.common.collect.Ordering;
import com.google.common.collect.Range;
import com.google.common.collect.Sets;
import com.google.common.collect.testing.TestCollectionGenerator;
import com.google.common.collect.testing.TestCollidingSetGenerator;
import com.google.common.collect.testing.TestIntegerSortedSetGenerator;
import com.google.common.collect.testing.TestSetGenerator;
Expand Down Expand Up @@ -120,11 +119,7 @@ protected Set<String> create(String[] elements) {
}
}

public static class ImmutableSetWithBadHashesGenerator extends TestCollidingSetGenerator
// Work around a GWT compiler bug. Not explicitly listing this will
// cause the createArray() method missing in the generated javascript.
// TODO: Remove this once the GWT bug is fixed.
implements TestCollectionGenerator<Object> {
public static class ImmutableSetWithBadHashesGenerator extends TestCollidingSetGenerator {
@Override
public Set<Object> create(Object... elements) {
return ImmutableSet.copyOf(elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ public void testGenericInterfaceDefaultValue() {

private interface NullRejectingFromTo<F, T> extends Function<F, T> {
@Override
public abstract T apply(F from);
T apply(F from);
}

private static class NullRejectingInterfaceDefaultValueChecker extends DefaultValueChecker {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ enum CollectionType {

final Supplier<Collection<Object>> supplier;

private CollectionType(Supplier<Collection<Object>> supplier) {
CollectionType(Supplier<Collection<Object>> supplier) {
this.supplier = supplier;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void zero() {
@FunctionalInterface
interface Construction<T> {
@CanIgnoreReturnValue
abstract T create(List<?> keys);
T create(List<?> keys);

static Construction<Map<Object, Object>> mapFromKeys(
Supplier<Map<Object, Object>> mutableSupplier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public enum ListSizeDistribution {
final int min;
final int max;

private ListSizeDistribution(int min, int max) {
ListSizeDistribution(int min, int max) {
this.min = min;
this.max = max;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum HashFunctionEnum {

private final HashFunction hashFunction;

private HashFunctionEnum(HashFunction hashFunction) {
HashFunctionEnum(HashFunction hashFunction) {
this.hashFunction = hashFunction;
}

Expand Down
Loading

0 comments on commit 7a0f11c

Please sign in to comment.