Change == null to is T to handle "double nullable" case
We use dummyValueOrNull<T>/ifNotNull combination to return a proper Future<T> when T is not known at compile time but a dummy value for T exists at run time, instead of falling back to creating a FakeFuture (that can't be awaited for example).
This works fine unless T itself allows null (is nullable or void). In this case dummyValueOrNull<T> returns null, but it's a proper T, not a failure. This CL changes ifNotNull to check is T instead of == null to handle this properly.
Change
== null
tois T
to handle "double nullable" caseWe use
dummyValueOrNull<T>
/ifNotNull
combination to return a properFuture<T>
whenT
is not known at compile time but a dummy value forT
exists at run time, instead of falling back to creating aFakeFuture
(that can't beawait
ed for example).This works fine unless
T
itself allowsnull
(is nullable orvoid
). In this casedummyValueOrNull<T>
returnsnull
, but it's a properT
, not a failure. This CL changesifNotNull
to checkis T
instead of== null
to handle this properly.