Skip to content

Restore 9.2 collect signature and add more API#7056

Merged
headius merged 1 commit intojruby:jruby-9.3from
headius:array_collect_java
Mar 16, 2022
Merged

Restore 9.2 collect signature and add more API#7056
headius merged 1 commit intojruby:jruby-9.3from
headius:array_collect_java

Conversation

@headius
Copy link
Member

@headius headius commented Jan 31, 2022

This addresses an issue found by jruby-openssl where we altered
the return value for a method in JRuby and broke backward compat
with JRuby 9.2 and earlier. Specifically we unintentionally caused
the RubyArray#collect(context, block) method to return IRubyObject
instead of RubyArray due to needing to return an enumerator for
some inputs.

As a result of this change, jruby-openssl compiled against the new
signature and became incompatible with JRuby 9.2.

This fix does not address the issue for JRuby 9.3.0 through 9.3.3,
which continue to have the bad signature. The restored signature
will remain through 9.3 and 9.4 maintenance at least, with two new
methods collectArray and collectEnum added to allow users to opt
into those specific paths. The Ruby-facing method is renamed to
rbCollect to indicate it is part of the Ruby interface for this
class.

See jruby/jruby-openssl#245

This addresses an issue found by jruby-openssl where we altered
the return value for a method in JRuby and broke backward compat
with JRuby 9.2 and earlier. Specifically we unintentionally caused
the RubyArray#collect(context, block) method to return IRubyObject
instead of RubyArray due to needing to return an enumerator for
some inputs.

As a result of this change, jruby-openssl compiled against the new
signature and became incompatible with JRuby 9.2.

This fix does not address the issue for JRuby 9.3.0 through 9.3.3,
which continue to have the bad signature. The restored signature
will remain through 9.3 and 9.4 maintenance at least, with two new
methods collectArray and collectEnum added to allow users to opt
into those specific paths. The Ruby-facing method is renamed to
rbCollect to indicate it is part of the Ruby interface for this
class.

See jruby/jruby-openssl#245
@headius headius added this to the JRuby 9.3.4.0 milestone Jan 31, 2022
@headius
Copy link
Member Author

headius commented Jan 31, 2022

For 9.3.0 through 9.3.3 the only feasible migration path would be to use collect19, which has the same signature in all 9.2 and 9.3 releases but supports the new behavior in 9.3. It is deprecated, so this is not a great answer.

Note also that collectCommon is removed as a method in this PR, after being added as a public method by mistake (the old public collect was simply renamed without changing visibility). This method was not intended to be exposed as a public RubyArray API.

@headius headius merged commit 88a6322 into jruby:jruby-9.3 Mar 16, 2022
@headius headius deleted the array_collect_java branch March 16, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant