
When trying to roll NullAway, ObservableSupplier started to be properly null-checked. This lead to the realization that: For an ObservableSupplier<@NonNull Foo>: 1) addObserver*() takes a Callback<@NonNull Foo> 2) except "addObserverAndCall()", which takes Callback<@Nullable Foo> This means that within the class, all callbacks should probably be Callback<@Nullable>, but it's not actually valid to cast a Callback<@NonNull> to Callback<@Nullable> since a callback expected a non-null should not receive a null. Since there are not yet any uses of addObserverAndCall(), I'm removing it for now. If we find compelling use-cases for it, we can add it back, and likely just mark the entire class as @NullUnmarked. I also realized that "addObserverAndCallIfSet()" is poor wording for @Nullable ObservableSuppliers, because they could be explicitly set to null. Rather than support "null" meaning "hasValue()=true", this renames the method to "addObserverAndCallIfNonNull()" Finally, this fixes an innocuous bug where UnwrapObservableSupplier observers were being called before a value was set. Bug: 389129271, 394598049 Change-Id: Idf82bb88255ead37f9f20ee2c13b215c1c497be4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6323286 Reviewed-by: Sky Malice <skym@chromium.org> Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: Fiaz Muhammad <mfiaz@google.com> Commit-Queue: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/main@{#1428580}
Chromium
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead,
follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.