Files
brave-core/android/java
Artem Samoilenko 6fa6898c28 [cr145][Android] Split ObservableSupplier into Nullable / Monotonic / NonNull variants
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/416a61c418c152a7a7ae568d89302e5ecb6e4a3d

commit 416a61c418c152a7a7ae568d89302e5ecb6e4a3d
Author: Andrew Grieve <agrieve@chromium.org>
Date:   Tue Dec 2 14:13:59 2025 -0800

    Android: Split ObservableSupplier into Nullable / Monotonic / NonNull variants

    The goal is to use proper @Nullable annotations with
    ObservableSuppliers.

    To achieve this, we use interfaces that define nullness:
     * (Settable)NullableObservableSupplier
     * (Settable)ObservableSupplier <-- monotonic
     * (Settable)NonNullObservableSupplier

    And we have ObservableSupplierImpl implement all of them.

    In order to make this migration manageable, I've marked the interfaces
    as @NullUnmarked, and will fix annotations in batches until they
    can be marked @NullMarked.

    This CL includes a batch in order to test out the new interfaces (and
    because many were necessary to make the change).

    Monotonic suppliers are by far the most common afaict, so that's why
    the non-prefixed ObservableSupplier is the monotonic one (that, and
    because "Monotonic" is a mouthful).

    One implication of this approach is that we'll never have:
       ObservableSupplier<@Nullable Foo>
    We'd have instead:
       NullableObservableSupplier<Foo>

    Having the nullness in the interface rather than in the generic
    allows for defining toNonNull() only on monotonic suppliers, and
    simplifies the implementation.

    Bug: 455874046
    Change-Id: Id48e235b9ff16a5b21a9c1199863150d17c22736
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7206746
    Commit-Queue: Andrew Grieve <agrieve@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Owners-Override: Andrew Grieve <agrieve@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1553094}
2026-01-29 13:40:19 -05:00
..