Conversation
Use the appropriate arity to get Enumerable#any to handle its args correctly. Note that we need to switch from JavaInternalBlockBody to a BlockCallback since JavaInternalBlockBody does not properly respect its arity in 1_7.
There was a problem hiding this comment.
Please let me know if my thinking is wrong on this line... since this is an instance method on RubyArray, which has a native each, this is always true and so can totally be deleted. Correct?
Let me know if I'm missing something... if we do want to call into RubyEnumerable here, I can restore this line (though it will need a switch on Ruby version to decide what arity the any block should use)
There was a problem hiding this comment.
I am trying to think of Enumerable is included into another core class which defines each. Although in that case it might also have an instance of any_p defined. I am ok with removing this.
There was a problem hiding this comment.
Interesting follow-up to this @enebo. Looking into #1265, I figured out what this line was good for: we don't want to directly consult the array elements for #any? if #each has bee overridden.
Restored the line in #1271 (though note I left out the RubyVersion switch since it's not used in the other places we're doing this. This probably leaves things subtly broken in 1.8, but in a pretty narrow use case: only affects multi-args yields on arrays which have #each overridden. Will have a look at it, and probably send another pull addressing it)
|
Travis note: the failures here are not related to this change. See a clean run of this branch here. |
Fix a stack overflow in Array#all (jruby#1265) and restore the correct behavior for Array#any (the needed isBuiltn check was incorrectly removed in jruby#1234) Also add a spec to ensure this remains stable going forward.
Fix a stack overflow in Array#all (jruby#1265) and restore the correct behavior for Array#any (the needed isBuiltn check was incorrectly removed in jruby#1234) Also add a spec to ensure this remains stable going forward.
Use the appropriate arity to get Enumerable#any to handle its args correctly. Note that we need to switch from JavaInternalBlockBody to a BlockCallback since JavaInternalBlockBody does not properly respect its arity in 1_7.
Note: this does not need to be merged into master.
any_specwas fixed for master in #1202