I think in general ReadableState.read() should not be @Nullable but we should allow for the overrides like ValueState to specify that T can be @Nullable while others like ListState we should have List<@Nullable T>.
On Tue, Jan 3, 2023 at 12:37 PM Reuven Lax via dev <dev@beam.apache.org> wrote: > It should be @Nullable - I'm not sure why that was removed. > > On Tue, Jan 3, 2023 at 12:18 PM Ahmet Altay via dev <dev@beam.apache.org> > wrote: > >> Forwarding, because this message got lost in the list moderation. >> >> ---------- Forwarded message ---------- >> From: Jeeno Lentin <jlen...@gmail.com> >> To: dev@beam.apache.org >> Cc: >> Bcc: >> Date: Fri, 23 Dec 2022 00:36:55 -0500 >> Subject: Beam Java SDK - ReadableState.read() shouldn't it be Nullable? >> Hi, >> >> We use the Beam Java SDK and are trying to upgrade version of Beam from >> version 2.31.0 to 2.43.0 >> >> While upgrading, we noticed that @Nullable annotation has been removed >> from org.apache.beam.sdk.state.ReadableState.read() >> >> I traced it back to this PR: https://github.com/apache/beam/pull/16721 >> >> We have the following concerns >> - If ReadableState.read() is really not nullable, shouldn’t there be a >> way to specify a default value when creating a state? Such a feature >> doesn’t seem to exist. >> - And what would it return initially when nothing is written to the state >> yet initially? >> >> Thank you, >> Jeeno >> >