Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid creating an entry whose key is null at construction time. #6198

Closed
wants to merge 1 commit into from

Commits on Oct 6, 2022

  1. Avoid creating an entry whose key is null at construction time.

    In the case of an entry whose key is stored in a `WeakReference`, the resulting entry will never be enqueued in the `ReferenceQueue`, so I'm not sure that it will necessarily ever be removed from the cache.
    
    Compare a similar change to `MapMakerInternalMap` that was part of cl/479157599.
    
    I get the impression that there may be a similar situation with weak _values_, but I'm not biting that off right now.
    
    As always, we [recommend](https://guava.dev/CacheBuilder) that you use [Caffeine](https://github.com/ben-manes/caffeine/wiki) instead of Guava's `cache` library.
    
    RELNOTES=n/a
    PiperOrigin-RevId: 479318112
    cpovirk authored and Google Java Core Libraries committed Oct 6, 2022
    Configuration menu
    Copy the full SHA
    cb9bf09 View commit details
    Browse the repository at this point in the history