Skip to content

Commit 01a398f

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Apply private to some classes that are nested directly inside a top-level class.
(We could apply it to some more deeply nested classes, too, but I don't want to go out of my way to do so: `private` would be redundant for any classes that are "effectively private.") Plus, address a few Error Prone warnings in the backport-only `ObjectCountHashMap`. Notably, delete `ObjectCountHashMap.MapEntry.setCount`, which was introduced in cl/181210213 but never used (because we always use `ObjectCountHashMap.setValue`, I think). RELNOTES=n/a PiperOrigin-RevId: 792628431
1 parent 6427251 commit 01a398f

File tree

58 files changed

+143
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+143
-150
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected List<TestSuite> createDerivedSuites(
6464
return derivedSuites;
6565
}
6666

67-
static class ReserializedCollectionGenerator<E> implements TestCollectionGenerator<E> {
67+
private static class ReserializedCollectionGenerator<E> implements TestCollectionGenerator<E> {
6868
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
6969

7070
private ReserializedCollectionGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected List<TestSuite> createDerivedSuites(
121121
return derivedSuites;
122122
}
123123

124-
static class ReserializedListGenerator<E> implements TestListGenerator<E> {
124+
private static class ReserializedListGenerator<E> implements TestListGenerator<E> {
125125
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
126126

127127
private ReserializedListGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ NavigableMapTestSuiteBuilder<K, V> subSuiteUsing(TestSortedMapGenerator<K, V> ge
139139
return using(generator);
140140
}
141141

142-
static class DescendingTestMapGenerator<K, V> extends ForwardingTestMapGenerator<K, V>
142+
private static class DescendingTestMapGenerator<K, V> extends ForwardingTestMapGenerator<K, V>
143143
implements TestSortedMapGenerator<K, V> {
144144
DescendingTestMapGenerator(TestSortedMapGenerator<K, V> delegate) {
145145
super(delegate);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected List<TestSuite> createDerivedSuites(
8787
return derivedSuites;
8888
}
8989

90-
static class ReserializedSetGenerator<E> implements TestSetGenerator<E> {
90+
private static class ReserializedSetGenerator<E> implements TestSetGenerator<E> {
9191
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
9292

9393
private ReserializedSetGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public Iterable<Entry<K, V>> order(List<Entry<K, V>> insertionOrder) {
435435
}
436436
}
437437

438-
static class ValuesGenerator<K, V, M extends Multimap<K, V>>
438+
private static class ValuesGenerator<K, V, M extends Multimap<K, V>>
439439
implements TestCollectionGenerator<V> {
440440
private final OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator;
441441

@@ -489,7 +489,7 @@ public Iterable<V> order(List<V> insertionOrder) {
489489
}
490490
}
491491

492-
static class KeysGenerator<K, V, M extends Multimap<K, V>>
492+
private static class KeysGenerator<K, V, M extends Multimap<K, V>>
493493
implements TestMultisetGenerator<K>, DerivedGenerator {
494494
private final OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator;
495495

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public Iterable<E> order(List<E> insertionOrder) {
196196
}
197197
}
198198

199-
static class EntrySetGenerator<E> implements TestSetGenerator<Multiset.Entry<E>> {
199+
private static class EntrySetGenerator<E> implements TestSetGenerator<Multiset.Entry<E>> {
200200
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
201201

202202
private EntrySetGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {
@@ -255,7 +255,7 @@ public Iterable<Entry<E>> order(List<Entry<E>> insertionOrder) {
255255
}
256256
}
257257

258-
static class ReserializedMultisetGenerator<E> implements TestMultisetGenerator<E> {
258+
private static class ReserializedMultisetGenerator<E> implements TestMultisetGenerator<E> {
259259
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
260260

261261
private ReserializedMultisetGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {

android/guava/src/com/google/common/base/FinalizableReferenceQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ URLClassLoader newLoader(URL base) {
377377
* Loads Finalizer directly using the current class loader. We won't be able to garbage collect
378378
* this class loader, but at least the world doesn't end.
379379
*/
380-
static class DirectLoader implements FinalizerLoader {
380+
private static class DirectLoader implements FinalizerLoader {
381381
@Override
382382
public Class<?> loadFinalizer() {
383383
try {

android/guava/src/com/google/common/base/Suppliers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE
171171
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
172172
}
173173

174-
@VisibleForTesting
175-
static class NonSerializableMemoizingSupplier<T extends @Nullable Object> implements Supplier<T> {
174+
private static class NonSerializableMemoizingSupplier<T extends @Nullable Object>
175+
implements Supplier<T> {
176176
private final Object lock = new Object();
177177

178178
@SuppressWarnings("UnnecessaryLambda") // Must be a fixed singleton object

android/guava/src/com/google/common/cache/CacheBuilderSpec.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
325325
}
326326

327327
/** Parse initialCapacity */
328-
static class InitialCapacityParser extends IntegerParser {
328+
private static class InitialCapacityParser extends IntegerParser {
329329
@Override
330330
protected void parseInteger(CacheBuilderSpec spec, int value) {
331331
checkArgument(
@@ -337,7 +337,7 @@ protected void parseInteger(CacheBuilderSpec spec, int value) {
337337
}
338338

339339
/** Parse maximumSize */
340-
static class MaximumSizeParser extends LongParser {
340+
private static class MaximumSizeParser extends LongParser {
341341
@Override
342342
protected void parseLong(CacheBuilderSpec spec, long value) {
343343
checkArgument(
@@ -349,7 +349,7 @@ protected void parseLong(CacheBuilderSpec spec, long value) {
349349
}
350350

351351
/** Parse maximumWeight */
352-
static class MaximumWeightParser extends LongParser {
352+
private static class MaximumWeightParser extends LongParser {
353353
@Override
354354
protected void parseLong(CacheBuilderSpec spec, long value) {
355355
checkArgument(
@@ -361,7 +361,7 @@ protected void parseLong(CacheBuilderSpec spec, long value) {
361361
}
362362

363363
/** Parse concurrencyLevel */
364-
static class ConcurrencyLevelParser extends IntegerParser {
364+
private static class ConcurrencyLevelParser extends IntegerParser {
365365
@Override
366366
protected void parseInteger(CacheBuilderSpec spec, int value) {
367367
checkArgument(
@@ -373,7 +373,7 @@ protected void parseInteger(CacheBuilderSpec spec, int value) {
373373
}
374374

375375
/** Parse weakKeys */
376-
static class KeyStrengthParser implements ValueParser {
376+
private static class KeyStrengthParser implements ValueParser {
377377
private final Strength strength;
378378

379379
public KeyStrengthParser(Strength strength) {
@@ -389,7 +389,7 @@ public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
389389
}
390390

391391
/** Parse weakValues and softValues */
392-
static class ValueStrengthParser implements ValueParser {
392+
private static class ValueStrengthParser implements ValueParser {
393393
private final Strength strength;
394394

395395
public ValueStrengthParser(Strength strength) {
@@ -407,7 +407,7 @@ public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
407407
}
408408

409409
/** Parse recordStats */
410-
static class RecordStatsParser implements ValueParser {
410+
private static class RecordStatsParser implements ValueParser {
411411

412412
@Override
413413
public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
@@ -457,7 +457,7 @@ public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
457457
}
458458

459459
/** Parse expireAfterAccess */
460-
static class AccessDurationParser extends DurationParser {
460+
private static class AccessDurationParser extends DurationParser {
461461
@Override
462462
protected void parseDuration(CacheBuilderSpec spec, long duration, TimeUnit unit) {
463463
checkArgument(spec.accessExpirationTimeUnit == null, "expireAfterAccess already set");
@@ -467,7 +467,7 @@ protected void parseDuration(CacheBuilderSpec spec, long duration, TimeUnit unit
467467
}
468468

469469
/** Parse expireAfterWrite */
470-
static class WriteDurationParser extends DurationParser {
470+
private static class WriteDurationParser extends DurationParser {
471471
@Override
472472
protected void parseDuration(CacheBuilderSpec spec, long duration, TimeUnit unit) {
473473
checkArgument(spec.writeExpirationTimeUnit == null, "expireAfterWrite already set");
@@ -477,7 +477,7 @@ protected void parseDuration(CacheBuilderSpec spec, long duration, TimeUnit unit
477477
}
478478

479479
/** Parse refreshAfterWrite */
480-
static class RefreshDurationParser extends DurationParser {
480+
private static class RefreshDurationParser extends DurationParser {
481481
@Override
482482
protected void parseDuration(CacheBuilderSpec spec, long duration, TimeUnit unit) {
483483
checkArgument(spec.refreshTimeUnit == null, "refreshAfterWrite already set");

android/guava/src/com/google/common/cache/LocalCache.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ static <E> Queue<E> discardingQueue() {
962962
*/
963963

964964
/** Used for strongly-referenced keys. */
965-
static class StrongEntry<K, V> extends AbstractReferenceEntry<K, V> {
965+
private static class StrongEntry<K, V> extends AbstractReferenceEntry<K, V> {
966966
final K key;
967967

968968
StrongEntry(K key, int hash, @Nullable ReferenceEntry<K, V> next) {
@@ -1182,7 +1182,7 @@ public void setPreviousInWriteQueue(ReferenceEntry<K, V> previous) {
11821182
}
11831183

11841184
/** Used for weakly-referenced keys. */
1185-
static class WeakEntry<K, V> extends WeakReference<K> implements ReferenceEntry<K, V> {
1185+
private static class WeakEntry<K, V> extends WeakReference<K> implements ReferenceEntry<K, V> {
11861186
WeakEntry(ReferenceQueue<K> queue, K key, int hash, @Nullable ReferenceEntry<K, V> next) {
11871187
super(key, queue);
11881188
this.hash = hash;
@@ -1470,7 +1470,8 @@ public void setPreviousInWriteQueue(ReferenceEntry<K, V> previous) {
14701470
}
14711471

14721472
/** References a weak value. */
1473-
static class WeakValueReference<K, V> extends WeakReference<V> implements ValueReference<K, V> {
1473+
private static class WeakValueReference<K, V> extends WeakReference<V>
1474+
implements ValueReference<K, V> {
14741475
final ReferenceEntry<K, V> entry;
14751476

14761477
WeakValueReference(ReferenceQueue<V> queue, V referent, ReferenceEntry<K, V> entry) {
@@ -1514,7 +1515,8 @@ public V waitForValue() {
15141515
}
15151516

15161517
/** References a soft value. */
1517-
static class SoftValueReference<K, V> extends SoftReference<V> implements ValueReference<K, V> {
1518+
private static class SoftValueReference<K, V> extends SoftReference<V>
1519+
implements ValueReference<K, V> {
15181520
final ReferenceEntry<K, V> entry;
15191521

15201522
SoftValueReference(ReferenceQueue<V> queue, V referent, ReferenceEntry<K, V> entry) {
@@ -1558,7 +1560,7 @@ public V waitForValue() {
15581560
}
15591561

15601562
/** References a strong value. */
1561-
static class StrongValueReference<K, V> implements ValueReference<K, V> {
1563+
private static class StrongValueReference<K, V> implements ValueReference<K, V> {
15621564
final V referent;
15631565

15641566
StrongValueReference(V referent) {
@@ -4491,7 +4493,7 @@ public boolean remove(Object o) {
44914493
* <p>Unfortunately, readResolve() doesn't get called when a circular dependency is present, so
44924494
* the proxy must be able to behave as the cache itself.
44934495
*/
4494-
static class ManualSerializationProxy<K, V> extends ForwardingCache<K, V>
4496+
private static class ManualSerializationProxy<K, V> extends ForwardingCache<K, V>
44954497
implements Serializable {
44964498
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 1;
44974499

0 commit comments

Comments
 (0)