Skip to content

Commit

Permalink
Annotate a safe racy initialization with @LazyInit.
Browse files Browse the repository at this point in the history
This makes TSAN happy.

Compare the other `@LazyInit` field in the class, added in cl/273585560 (and others in other classes).

RELNOTES=n/a
PiperOrigin-RevId: 445432352
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Apr 29, 2022
1 parent a5660b4 commit 3c9e679
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions android/guava/src/com/google/common/collect/HashBiMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ public void clear() {
}
}

private transient Set<K> keySet;
@LazyInit private transient Set<K> keySet;

@Override
public Set<K> keySet() {
Expand Down Expand Up @@ -787,7 +787,7 @@ public boolean remove(@CheckForNull Object o) {
}
}

private transient Set<V> valueSet;
@LazyInit private transient Set<V> valueSet;

@Override
public Set<V> values() {
Expand Down Expand Up @@ -825,7 +825,7 @@ public boolean remove(@CheckForNull Object o) {
}
}

private transient Set<Entry<K, V>> entrySet;
@LazyInit private transient Set<Entry<K, V>> entrySet;

@Override
public Set<Entry<K, V>> entrySet() {
Expand Down

0 comments on commit 3c9e679

Please sign in to comment.