-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloseableIterator.stream()
reports improper Spliterator
size
#2519
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Dec 22, 2021
mp911de
added
type: bug
A general bug
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Jan 3, 2022
mp911de
changed the title
CloseableIterator.stream() colide with toList of Java 16
Jan 3, 2022
CloseableIterator.stream()
reports improper Spliterator
size
Thanks for reporting the issue. The size value of |
mp911de
added a commit
that referenced
this issue
Jan 3, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
mp911de
added a commit
that referenced
this issue
Jan 3, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
mp911de
added a commit
that referenced
this issue
Jan 3, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
mp911de
added a commit
that referenced
this issue
Jan 3, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
mp911de
added a commit
that referenced
this issue
Jan 3, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
mp911de
added a commit
that referenced
this issue
Jan 3, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
schauder
pushed a commit
that referenced
this issue
Jan 13, 2022
We now report -1 as size to avoid zero-size results for count() or toList() operators. Closes #2519
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stream.toList()
was added in Java 16.In here,
Nodes.builder(…)
decides to generate a fixed size node or a variable size node.The result of
AbstractPipeline.exactOutputSizeIfKnown()
is used as the size, and the method checks thecharacteristics
flags of a source spliterator.The default implementation of
CloseableIterator.stream()
in Spring data seems to create a source spliterator withcharacteristic
representing fixed size of 0.Because of this,
Nodes.builder(...)
generates a fixed size node builder with size 0.After, when
Stream.toList()
try to put an element to this node builder, it throws an exception inFixedNodeBuilder.accept(T)
with messageAccept exceeded fixed size of 0
.You can reproduce this issue using the code below.
It would be nice to resolve this collision.
Tested with
The text was updated successfully, but these errors were encountered: