Skip to content

Commit 56ee117

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Address a few more Error Prone warnings.
RELNOTES=n/a PiperOrigin-RevId: 864459246
1 parent 8551cd9 commit 56ee117

File tree

10 files changed

+30
-26
lines changed

10 files changed

+30
-26
lines changed

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
@@ -439,7 +439,7 @@ private static final class ValuesGenerator<K, V, M extends Multimap<K, V>>
439439
implements TestCollectionGenerator<V> {
440440
private final OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator;
441441

442-
public ValuesGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
442+
ValuesGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
443443
this.multimapGenerator = multimapGenerator;
444444
}
445445

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

496-
public KeysGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
496+
KeysGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
497497
this.multimapGenerator = multimapGenerator;
498498
}
499499

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ private Defaults() {}
3939
* false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and
4040
* {@code void}, {@code null} is returned.
4141
*/
42-
@SuppressWarnings("unchecked")
42+
@SuppressWarnings({
43+
"unchecked",
44+
"BooleanLiteral" // `(T) false` would produce an error
45+
})
4346
public static <T> @Nullable T defaultValue(Class<T> type) {
4447
checkNotNull(type);
4548
if (type.isPrimitive()) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ protected void parseInteger(CacheBuilderSpec spec, int value) {
377377
private static final class KeyStrengthParser implements ValueParser {
378378
private final Strength strength;
379379

380-
public KeyStrengthParser(Strength strength) {
380+
KeyStrengthParser(Strength strength) {
381381
this.strength = strength;
382382
}
383383

@@ -393,7 +393,7 @@ public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
393393
private static final class ValueStrengthParser implements ValueParser {
394394
private final Strength strength;
395395

396-
public ValueStrengthParser(Strength strength) {
396+
ValueStrengthParser(Strength strength) {
397397
this.strength = strength;
398398
}
399399

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,8 @@ public ImmutableSet<K> keySet() {
954954
}
955955

956956
/*
957-
* This could have a good default implementation of return new ImmutableKeySet<K, V>(this),
958-
* but ProGuard can't figure out how to eliminate that default when RegularImmutableMap
959-
* overrides it.
957+
* This could have a good default implementation of `return new ImmutableKeySet<K, V>(this)`, but
958+
* ProGuard can't figure out how to eliminate that default when RegularImmutableMap overrides it.
960959
*/
961960
abstract ImmutableSet<K> createKeySet();
962961

@@ -988,9 +987,9 @@ public ImmutableCollection<V> values() {
988987
}
989988

990989
/*
991-
* This could have a good default implementation of {@code return new
992-
* ImmutableMapValues<K, V>(this)}, but ProGuard can't figure out how to eliminate that default
993-
* when RegularImmutableMap overrides it.
990+
* This could have a good default implementation of `return new ImmutableMapValues<K, V>(this)`,
991+
* but ProGuard can't figure out how to eliminate that default when RegularImmutableMap overrides
992+
* it.
994993
*/
995994
abstract ImmutableCollection<V> createValues();
996995

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ private static class TransformedEntriesSortedMap<
20952095
K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object>
20962096
extends TransformedEntriesMap<K, V1, V2> implements SortedMap<K, V2> {
20972097

2098-
protected SortedMap<K, V1> fromMap() {
2098+
SortedMap<K, V1> fromMap() {
20992099
return (SortedMap<K, V1>) fromMap;
21002100
}
21012101

@@ -2262,7 +2262,7 @@ public NavigableMap<K, V2> tailMap(@ParametricNullness K fromKey, boolean inclus
22622262
}
22632263

22642264
@Override
2265-
protected NavigableMap<K, V1> fromMap() {
2265+
NavigableMap<K, V1> fromMap() {
22662266
return (NavigableMap<K, V1>) super.fromMap();
22672267
}
22682268
}

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
@@ -440,7 +440,7 @@ private static final class ValuesGenerator<K, V, M extends Multimap<K, V>>
440440
implements TestCollectionGenerator<V> {
441441
private final OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator;
442442

443-
public ValuesGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
443+
ValuesGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
444444
this.multimapGenerator = multimapGenerator;
445445
}
446446

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

497-
public KeysGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
497+
KeysGenerator(OneSizeTestContainerGenerator<M, Entry<K, V>> multimapGenerator) {
498498
this.multimapGenerator = multimapGenerator;
499499
}
500500

guava/src/com/google/common/base/Defaults.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ private Defaults() {}
3939
* false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and
4040
* {@code void}, {@code null} is returned.
4141
*/
42-
@SuppressWarnings("unchecked")
42+
@SuppressWarnings({
43+
"unchecked",
44+
"BooleanLiteral" // `(T) false` would produce an error
45+
})
4346
public static <T> @Nullable T defaultValue(Class<T> type) {
4447
checkNotNull(type);
4548
if (type.isPrimitive()) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ protected void parseInteger(CacheBuilderSpec spec, int value) {
377377
private static final class KeyStrengthParser implements ValueParser {
378378
private final Strength strength;
379379

380-
public KeyStrengthParser(Strength strength) {
380+
KeyStrengthParser(Strength strength) {
381381
this.strength = strength;
382382
}
383383

@@ -393,7 +393,7 @@ public void parse(CacheBuilderSpec spec, String key, @Nullable String value) {
393393
private static final class ValueStrengthParser implements ValueParser {
394394
private final Strength strength;
395395

396-
public ValueStrengthParser(Strength strength) {
396+
ValueStrengthParser(Strength strength) {
397397
this.strength = strength;
398398
}
399399

guava/src/com/google/common/collect/ImmutableMap.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,9 +1067,8 @@ public ImmutableSet<K> keySet() {
10671067
}
10681068

10691069
/*
1070-
* This could have a good default implementation of return new ImmutableKeySet<K, V>(this),
1071-
* but ProGuard can't figure out how to eliminate that default when RegularImmutableMap
1072-
* overrides it.
1070+
* This could have a good default implementation of `return new ImmutableKeySet<K, V>(this)`, but
1071+
* ProGuard can't figure out how to eliminate that default when RegularImmutableMap overrides it.
10731072
*/
10741073
abstract ImmutableSet<K> createKeySet();
10751074

@@ -1109,9 +1108,9 @@ public ImmutableCollection<V> values() {
11091108
}
11101109

11111110
/*
1112-
* This could have a good default implementation of {@code return new
1113-
* ImmutableMapValues<K, V>(this)}, but ProGuard can't figure out how to eliminate that default
1114-
* when RegularImmutableMap overrides it.
1111+
* This could have a good default implementation of `return new ImmutableMapValues<K, V>(this)`,
1112+
* but ProGuard can't figure out how to eliminate that default when RegularImmutableMap overrides
1113+
* it.
11151114
*/
11161115
abstract ImmutableCollection<V> createValues();
11171116

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ private static class TransformedEntriesSortedMap<
22032203
K extends @Nullable Object, V1 extends @Nullable Object, V2 extends @Nullable Object>
22042204
extends TransformedEntriesMap<K, V1, V2> implements SortedMap<K, V2> {
22052205

2206-
protected SortedMap<K, V1> fromMap() {
2206+
SortedMap<K, V1> fromMap() {
22072207
return (SortedMap<K, V1>) fromMap;
22082208
}
22092209

@@ -2370,7 +2370,7 @@ public NavigableMap<K, V2> tailMap(@ParametricNullness K fromKey, boolean inclus
23702370
}
23712371

23722372
@Override
2373-
protected NavigableMap<K, V1> fromMap() {
2373+
NavigableMap<K, V1> fromMap() {
23742374
return (NavigableMap<K, V1>) super.fromMap();
23752375
}
23762376
}

0 commit comments

Comments
 (0)