You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could change the declaration of T to just <T>. That would be "simpler," and it could maybe in theory help someone who isn't realizing that the output is a Stream<@NonNull E> for some parametric-nullness type parameter E? But it might also annoy people who do actually want a Stream<SomeTypeThatMightIncludeNull>.
(TODO: Dig up past discussions of google/guava#1927 (comment) through the lens of nullness. The idea here would be that you can always map(t -> t) to change the type if you want to. [edit: Here we go: jspecify/jspecify#525. And I guess maybe this issue fits better in the jspecify/jspecify repo unless we do want to start using this repo's issues more?])
One thing to note is that the current signature works well for the Checker Framework for converting a Stream<@Nullable Foo> to a Stream<Foo> via flatMap(Stream::ofNullable). I imagine that the proposed signature would, too, but it would be good to check.
The text was updated successfully, but these errors were encountered:
https://github.com/jspecify/jdk/blob/3669c24f878cf1dbaf42ccd75b002cdbc94fd4da/src/java.base/share/classes/java/util/stream/Stream.java#L1471C57-L1471C67
We could change the declaration of
T
to just<T>
. That would be "simpler," and it could maybe in theory help someone who isn't realizing that the output is aStream<@NonNull E>
for some parametric-nullness type parameterE
? But it might also annoy people who do actually want aStream<SomeTypeThatMightIncludeNull>
.(TODO: Dig up past discussions of google/guava#1927 (comment) through the lens of nullness. The idea here would be that you can always
map(t -> t)
to change the type if you want to. [edit: Here we go: jspecify/jspecify#525. And I guess maybe this issue fits better in the jspecify/jspecify repo unless we do want to start using this repo's issues more?])One thing to note is that the current signature works well for the Checker Framework for converting a
Stream<@Nullable Foo>
to aStream<Foo>
viaflatMap(Stream::ofNullable)
. I imagine that the proposed signature would, too, but it would be good to check.The text was updated successfully, but these errors were encountered: