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

RubyEnumerator implements java.util.Iterator #4054

Merged
merged 5 commits into from Aug 24, 2016

Conversation

Projects
None yet
3 participants
@kares
Member

kares commented Aug 8, 2016

feels like a good fit and this makes enumerator usable with Java 8 (with some boilerplate) :
java.util.Spliterators.spliterator(enum.to_java, enum.size || -1, charactestistics)

... ideally some more integration would be handy but JRuby would need compiling under Java 8 for easy : [1, 2, 3, 4, 5].each.to_java.stream or Enumerator.new { ... }.to_java.spliterator implementations.
esp. since the Enumeration's size and the spliterator characteristic are depend on internals. so this would like get revisited after a potential compilation switch in another release.

Ruby enumerator (and thus Ruby array) usability with 8 streaming is confirmed with test-cases.

kares added some commits Aug 4, 2016

@kares kares added this to the JRuby 9.1.3.0 milestone Aug 11, 2016

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Aug 15, 2016

Member

... ideally some more integration would be handy but JRuby would need compiling under Java 8 for easy : [1, 2, 3, 4, 5].each.to_java.stream or Enumerator.new { ... }.to_java.spliterator implementations.
esp. since the Enumeration's size and the spliterator characteristic are depend on internals. so this would like get revisited after a potential compilation switch in another release.

also possible by hooking up stream/spliterator on org.jruby.RubyEnumerator (in plain .rb for now)

// cc @headius @enebo let me know what do you think about getting this merged for 9.1.3

Member

kares commented Aug 15, 2016

... ideally some more integration would be handy but JRuby would need compiling under Java 8 for easy : [1, 2, 3, 4, 5].each.to_java.stream or Enumerator.new { ... }.to_java.spliterator implementations.
esp. since the Enumeration's size and the spliterator characteristic are depend on internals. so this would like get revisited after a potential compilation switch in another release.

also possible by hooking up stream/spliterator on org.jruby.RubyEnumerator (in plain .rb for now)

// cc @headius @enebo let me know what do you think about getting this merged for 9.1.3

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Aug 23, 2016

Member

@kares 👍 from me. @enebo?

Member

headius commented Aug 23, 2016

@kares 👍 from me. @enebo?

[ji] add .rb bits for Enumerator Java 8 extensions `enum.to_java.stream`
... this would be desirable/possible to do in RubyEnumerator.java
but we can not since we're not compliling under Java 8

it is still useful to be able to do `enum.to_java.stream` from Ruby
@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Aug 24, 2016

Member

thanks for the review, have added the .rb part helpers (under Java 8) spliterator and stream since due compilation under Java 7 those can not be implemented in org.jruby.RubyEnumerator atm

Member

kares commented Aug 24, 2016

thanks for the review, have added the .rb part helpers (under Java 8) spliterator and stream since due compilation under Java 7 those can not be implemented in org.jruby.RubyEnumerator atm

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Aug 24, 2016

Member

@kares looks fine by me

Member

enebo commented Aug 24, 2016

@kares looks fine by me

@kares kares merged commit a0ea58c into jruby:master Aug 24, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment