Skip to content

Commit 5a37594

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Make more private classes final.
Like cl/784189028 but for non-`static` classes. RELNOTES=n/a PiperOrigin-RevId: 784585587
1 parent 8eec09e commit 5a37594

29 files changed

+65
-65
lines changed

android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRetainAllTester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
4747

4848
/** A collection of elements to retain, along with a description for use in failure messages. */
49-
private class Target {
49+
private final class Target {
5050
private final Collection<E> toRetain;
5151
private final String description;
5252

android/guava-testlib/src/com/google/common/testing/DummyProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ final <T> T newProxy(TypeToken<T> interfaceType) {
8282
/** Returns the dummy return value for {@code returnType}. */
8383
abstract <R> @Nullable R dummyReturnValue(TypeToken<R> returnType);
8484

85-
private class DummyHandler extends AbstractInvocationHandler implements Serializable {
85+
private final class DummyHandler extends AbstractInvocationHandler implements Serializable {
8686
private final TypeToken<?> interfaceType;
8787

8888
DummyHandler(TypeToken<?> interfaceType) {

android/guava/src/com/google/common/collect/AbstractBiMap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public Set<K> keySet() {
212212
}
213213

214214
@WeakOuter
215-
private class KeySet extends ForwardingSet<K> {
215+
private final class KeySet extends ForwardingSet<K> {
216216
@Override
217217
protected Set<K> delegate() {
218218
return delegate.keySet();
@@ -261,7 +261,7 @@ public Set<V> values() {
261261
}
262262

263263
@WeakOuter
264-
private class ValueSet extends ForwardingSet<V> {
264+
private final class ValueSet extends ForwardingSet<V> {
265265
final Set<V> valuesDelegate = inverse.keySet();
266266

267267
@Override
@@ -358,7 +358,7 @@ public void remove() {
358358
}
359359

360360
@WeakOuter
361-
private class EntrySet extends ForwardingSet<Entry<K, V>> {
361+
private final class EntrySet extends ForwardingSet<Entry<K, V>> {
362362
final Set<Entry<K, V>> esDelegate = delegate.entrySet();
363363

364364
@Override

android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ public List<V> subList(int fromIndex, int toIndex) {
853853
}
854854

855855
/** ListIterator decorator. */
856-
private class WrappedListIterator extends WrappedIterator implements ListIterator<V> {
856+
private final class WrappedListIterator extends WrappedIterator implements ListIterator<V> {
857857
WrappedListIterator() {}
858858

859859
WrappedListIterator(int index) {
@@ -906,7 +906,7 @@ public void add(@ParametricNullness V value) {
906906
* List decorator that stays in sync with the multimap values for a key and supports rapid random
907907
* access.
908908
*/
909-
private class RandomAccessWrappedList extends WrappedList implements RandomAccess {
909+
private final class RandomAccessWrappedList extends WrappedList implements RandomAccess {
910910
RandomAccessWrappedList(
911911
@ParametricNullness K key, List<V> delegate, @Nullable WrappedCollection ancestor) {
912912
super(key, delegate, ancestor);

android/guava/src/com/google/common/collect/ArrayTable.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ public C getColumnKey() {
600600
}
601601
}
602602

603-
private class Column extends ArrayMap<R, @Nullable V> {
603+
private final class Column extends ArrayMap<R, @Nullable V> {
604604
final int columnIndex;
605605

606606
Column(int columnIndex) {
@@ -644,7 +644,7 @@ public ImmutableSet<C> columnKeySet() {
644644
}
645645

646646
@WeakOuter
647-
private class ColumnMap extends ArrayMap<C, Map<R, @Nullable V>> {
647+
private final class ColumnMap extends ArrayMap<C, Map<R, @Nullable V>> {
648648
private ColumnMap() {
649649
super(columnKeyToIndex);
650650
}
@@ -692,7 +692,7 @@ String getKeyRole() {
692692
}
693693
}
694694

695-
private class Row extends ArrayMap<C, @Nullable V> {
695+
private final class Row extends ArrayMap<C, @Nullable V> {
696696
final int rowIndex;
697697

698698
Row(int rowIndex) {
@@ -736,7 +736,7 @@ public ImmutableSet<R> rowKeySet() {
736736
}
737737

738738
@WeakOuter
739-
private class RowMap extends ArrayMap<R, Map<C, @Nullable V>> {
739+
private final class RowMap extends ArrayMap<R, Map<C, @Nullable V>> {
740740
private RowMap() {
741741
super(rowKeyToIndex);
742742
}

android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ public void clear() {
561561
}
562562

563563
@WeakOuter
564-
private class EntrySet extends AbstractMultiset<E>.EntrySet {
564+
private final class EntrySet extends AbstractMultiset<E>.EntrySet {
565565
@Override
566566
ConcurrentHashMultiset<E> multiset() {
567567
return ConcurrentHashMultiset.this;

android/guava/src/com/google/common/collect/LinkedListMultimap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private void removeAllNodes(@ParametricNullness K key) {
297297
}
298298

299299
/** An {@code Iterator} over all nodes. */
300-
private class NodeIterator implements ListIterator<Entry<K, V>> {
300+
private final class NodeIterator implements ListIterator<Entry<K, V>> {
301301
int nextIndex;
302302
@Nullable Node<K, V> next;
303303
@Nullable Node<K, V> current;
@@ -408,7 +408,7 @@ void setValue(@ParametricNullness V value) {
408408
}
409409

410410
/** An {@code Iterator} over distinct keys in key head order. */
411-
private class DistinctKeyIterator implements Iterator<K> {
411+
private final class DistinctKeyIterator implements Iterator<K> {
412412
final Set<K> seenKeys = Sets.<K>newHashSetWithExpectedSize(keySet().size());
413413
@Nullable Node<K, V> next = head;
414414
@Nullable Node<K, V> current;
@@ -452,7 +452,7 @@ public void remove() {
452452
}
453453

454454
/** A {@code ListIterator} over values for a specified key. */
455-
private class ValueForKeyIterator implements ListIterator<V> {
455+
private final class ValueForKeyIterator implements ListIterator<V> {
456456
@ParametricNullness final K key;
457457
int nextIndex;
458458
@Nullable Node<K, V> next;

android/guava/src/com/google/common/collect/Maps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2917,7 +2917,7 @@ protected Set<Entry<K, V>> createEntrySet() {
29172917
}
29182918

29192919
@WeakOuter
2920-
private class EntrySet extends ForwardingSet<Entry<K, V>> {
2920+
private final class EntrySet extends ForwardingSet<Entry<K, V>> {
29212921
@Override
29222922
protected Set<Entry<K, V>> delegate() {
29232923
return filteredEntrySet;

android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ private int getGrandparentIndex(int i) {
767767
*
768768
* <p>If the underlying queue is modified during iteration an exception will be thrown.
769769
*/
770-
private class QueueIterator implements Iterator<E> {
770+
private final class QueueIterator implements Iterator<E> {
771771
private int cursor = -1;
772772
private int nextCursor = -1;
773773
private int expectedModCount = modCount;

android/guava/src/com/google/common/collect/StandardRowSortedTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ SortedMap<R, Map<C, V>> createRowMap() {
9393
}
9494

9595
@WeakOuter
96-
private class RowSortedMap extends RowMap implements SortedMap<R, Map<C, V>> {
96+
private final class RowSortedMap extends RowMap implements SortedMap<R, Map<C, V>> {
9797
@Override
9898
public SortedSet<R> keySet() {
9999
return (SortedSet<R>) super.keySet();

0 commit comments

Comments
 (0)