Skip to content

Commit f6b2e04

Browse files
Vincent PotucekGoogle Java Core Libraries
authored andcommitted
Add some missing @Override annotations, and remove some unused imports.
From #7916 / #7917 RELNOTES=n/a PiperOrigin-RevId: 791773570
1 parent 43c3d40 commit f6b2e04

File tree

13 files changed

+47
-2
lines changed

13 files changed

+47
-2
lines changed

android/guava-testlib/test/com/google/common/collect/testing/IteratorTesterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.google.common.collect.Lists.newArrayList;
2020
import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE;
21-
import static java.util.Collections.emptyList;
2221

2322
import com.google.common.annotations.GwtCompatible;
2423
import com.google.common.collect.ImmutableList;

guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LocalCache.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,12 @@ public long getWriteTimestamp() {
349349
return writeTimestamp;
350350
}
351351

352+
@Override
352353
public boolean equals(Object o) {
353354
return value.equals(o);
354355
}
355356

357+
@Override
356358
public int hashCode() {
357359
return value.hashCode();
358360
}

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public boolean containsAll(Collection<?> targets) {
4848
return delegate.containsAll(targets);
4949
}
5050

51+
@Override
5152
public int size() {
5253
return delegate.size();
5354
}

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableList.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,22 @@ abstract class ForwardingImmutableList<E> extends ImmutableList<E> {
3131

3232
abstract List<E> delegateList();
3333

34+
@Override
3435
public int indexOf(@Nullable Object object) {
3536
return delegateList().indexOf(object);
3637
}
3738

39+
@Override
3840
public int lastIndexOf(@Nullable Object object) {
3941
return delegateList().lastIndexOf(object);
4042
}
4143

44+
@Override
4245
public E get(int index) {
4346
return delegateList().get(index);
4447
}
4548

49+
@Override
4650
public ImmutableList<E> subList(int fromIndex, int toIndex) {
4751
return unsafeDelegateList(delegateList().subList(fromIndex, toIndex));
4852
}
@@ -79,6 +83,7 @@ public boolean containsAll(Collection<?> targets) {
7983
return delegateList().containsAll(targets);
8084
}
8185

86+
@Override
8287
public int size() {
8388
return delegateList().size();
8489
}

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,27 @@ public abstract class ForwardingImmutableMap<K, V> extends ImmutableMap<K, V> {
4949
this.delegate = Collections.unmodifiableMap(delegate);
5050
}
5151

52+
@Override
5253
boolean isPartialView() {
5354
return false;
5455
}
5556

57+
@Override
5658
public final boolean isEmpty() {
5759
return delegate.isEmpty();
5860
}
5961

62+
@Override
6063
public final boolean containsKey(@Nullable Object key) {
6164
return Maps.safeContainsKey(delegate, key);
6265
}
6366

67+
@Override
6468
public final boolean containsValue(@Nullable Object value) {
6569
return delegate.containsValue(value);
6670
}
6771

72+
@Override
6873
public @Nullable V get(@Nullable Object key) {
6974
return (key == null) ? null : Maps.safeGet(delegate, key);
7075
}

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMap.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>>
196196
}
197197

198198
@CanIgnoreReturnValue
199+
@Override
199200
public Builder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
200201
super.orderEntriesByValue(valueComparator);
201202
return this;

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,45 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
3939

4040
ImmutableCollection() {}
4141

42+
@Override
4243
public abstract UnmodifiableIterator<E> iterator();
4344

45+
@Override
4446
public boolean contains(@Nullable Object object) {
4547
return object != null && super.contains(object);
4648
}
4749

50+
@Override
4851
public final boolean add(E e) {
4952
throw new UnsupportedOperationException();
5053
}
5154

55+
@Override
5256
public final boolean remove(@Nullable Object object) {
5357
throw new UnsupportedOperationException();
5458
}
5559

60+
@Override
5661
public final boolean addAll(Collection<? extends E> newElements) {
5762
throw new UnsupportedOperationException();
5863
}
5964

65+
@Override
6066
public final boolean removeAll(Collection<?> oldElements) {
6167
throw new UnsupportedOperationException();
6268
}
6369

70+
@Override
6471
public final boolean removeIf(Predicate<? super E> predicate) {
6572
throw new UnsupportedOperationException();
6673
}
6774

75+
@Override
6876
public final boolean retainAll(Collection<?> elementsToKeep) {
6977
throw new UnsupportedOperationException();
7078
}
7179

80+
@Override
7281
public final void clear() {
7382
throw new UnsupportedOperationException();
7483
}

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,18 +231,22 @@ public int lastIndexOf(@Nullable Object object) {
231231
return (object == null) ? -1 : Lists.lastIndexOfImpl(this, object);
232232
}
233233

234+
@Override
234235
public final boolean addAll(int index, Collection<? extends E> newElements) {
235236
throw new UnsupportedOperationException();
236237
}
237238

239+
@Override
238240
public final E set(int index, E element) {
239241
throw new UnsupportedOperationException();
240242
}
241243

244+
@Override
242245
public final void add(int index, E element) {
243246
throw new UnsupportedOperationException();
244247
}
245248

249+
@Override
246250
public final E remove(int index) {
247251
throw new UnsupportedOperationException();
248252
}

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,18 +402,22 @@ public static <K, V> ImmutableMap<K, V> copyOf(
402402

403403
abstract boolean isPartialView();
404404

405+
@Override
405406
public final @Nullable V put(K k, V v) {
406407
throw new UnsupportedOperationException();
407408
}
408409

410+
@Override
409411
public final @Nullable V remove(Object o) {
410412
throw new UnsupportedOperationException();
411413
}
412414

415+
@Override
413416
public final void putAll(Map<? extends K, ? extends V> map) {
414417
throw new UnsupportedOperationException();
415418
}
416419

420+
@Override
417421
public final void clear() {
418422
throw new UnsupportedOperationException();
419423
}
@@ -435,6 +439,7 @@ public boolean containsValue(@Nullable Object value) {
435439

436440
private transient @Nullable ImmutableSet<Entry<K, V>> cachedEntrySet = null;
437441

442+
@Override
438443
public final ImmutableSet<Entry<K, V>> entrySet() {
439444
if (cachedEntrySet != null) {
440445
return cachedEntrySet;
@@ -446,6 +451,7 @@ public final ImmutableSet<Entry<K, V>> entrySet() {
446451

447452
private transient @Nullable ImmutableSet<K> cachedKeySet = null;
448453

454+
@Override
449455
public ImmutableSet<K> keySet() {
450456
if (cachedKeySet != null) {
451457
return cachedKeySet;
@@ -478,6 +484,7 @@ Spliterator<K> keySpliterator() {
478484

479485
private transient @Nullable ImmutableCollection<V> cachedValues = null;
480486

487+
@Override
481488
public ImmutableCollection<V> values() {
482489
if (cachedValues != null) {
483490
return cachedValues;

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ public ImmutableList<E> asList() {
198198
}
199199
}
200200

201+
@Override
201202
ImmutableList<E> createAsList() {
202203
return new RegularImmutableAsList<E>(this, toArray());
203204
}

0 commit comments

Comments
 (0)