Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 726161782
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Feb 12, 2025
1 parent d0c23aa commit 11bfc68
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ public void testEntrySetEquals() {

@CollectionSize.Require(SEVERAL)
@MapFeature.Require(SUPPORTS_REMOVE)
/*
* ListMultimap.asMap essentially returns a Map<K, List<V>>; we just can't declare it that way.
* Thus, calls like asMap().values().remove(someList) are safe because they are comparing a list
* to a collection of other lists.
*/
@SuppressWarnings("CollectionUndefinedEquality")
public void testValuesRemove() {
resetContainer(mapEntry(k0(), v0()), mapEntry(k1(), v0()), mapEntry(k0(), v3()));
assertTrue(multimap().asMap().values().remove(singletonList(v0())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ public void testEntrySetEquals() {

@CollectionSize.Require(SEVERAL)
@MapFeature.Require(SUPPORTS_REMOVE)
/*
* SetMultimap.asMap essentially returns a Map<K, Set<V>>; we just can't declare it that way.
* Thus, calls like asMap().values().remove(someSet) are safe because they are comparing a set to
* a collection of other sets.
*/
@SuppressWarnings("CollectionUndefinedEquality")
public void testValuesRemove() {
resetContainer(mapEntry(k0(), v0()), mapEntry(k1(), v0()), mapEntry(k0(), v3()));
assertTrue(multimap().asMap().values().remove(singleton(v0())));
Expand Down
2 changes: 2 additions & 0 deletions android/guava/src/com/google/common/collect/Synchronized.java
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,8 @@ public Collection<Collection<V>> values() {
}

@Override
// A forwarding implementation can't do any better than the underlying object.
@SuppressWarnings("CollectionUndefinedEquality")
public boolean containsValue(@Nullable Object o) {
// values() and its contains() method are both synchronized.
return values().contains(o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ public void testEntrySetEquals() {

@CollectionSize.Require(SEVERAL)
@MapFeature.Require(SUPPORTS_REMOVE)
/*
* ListMultimap.asMap essentially returns a Map<K, List<V>>; we just can't declare it that way.
* Thus, calls like asMap().values().remove(someList) are safe because they are comparing a list
* to a collection of other lists.
*/
@SuppressWarnings("CollectionUndefinedEquality")
public void testValuesRemove() {
resetContainer(mapEntry(k0(), v0()), mapEntry(k1(), v0()), mapEntry(k0(), v3()));
assertTrue(multimap().asMap().values().remove(singletonList(v0())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ public void testEntrySetEquals() {

@CollectionSize.Require(SEVERAL)
@MapFeature.Require(SUPPORTS_REMOVE)
/*
* SetMultimap.asMap essentially returns a Map<K, Set<V>>; we just can't declare it that way.
* Thus, calls like asMap().values().remove(someSet) are safe because they are comparing a set to
* a collection of other sets.
*/
@SuppressWarnings("CollectionUndefinedEquality")
public void testValuesRemove() {
resetContainer(mapEntry(k0(), v0()), mapEntry(k1(), v0()), mapEntry(k0(), v3()));
assertTrue(multimap().asMap().values().remove(singleton(v0())));
Expand Down
2 changes: 2 additions & 0 deletions guava/src/com/google/common/collect/Synchronized.java
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,8 @@ public Collection<Collection<V>> values() {
}

@Override
// A forwarding implementation can't do any better than the underlying object.
@SuppressWarnings("CollectionUndefinedEquality")
public boolean containsValue(@Nullable Object o) {
// values() and its contains() method are both synchronized.
return values().contains(o);
Expand Down

0 comments on commit 11bfc68

Please sign in to comment.