Regression on java array slices with a negative index introduced in 126.96.36.199 #5698
$ jruby --version jruby 188.8.131.52 (2.5.0) 2018-11-06 7b14404 OpenJDK 64-Bit Server VM 25.191-b12 on 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12 +jit [linux-x86_64] $ echo $JRUBY_OPTS $ uname -a Linux the_hostname 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
I expect that slicing Java arrays with negative indexes works like it does in Ruby arrays, or even like it used to work for Java arrays before 184.108.40.206.
See https://ruby-doc.org/core-2.5.0/Array.html#method-i-slice, with emphasis on:
Here is an example of the behavior I would expect:
# Ruby array slicing with a negative index in 220.127.116.11 works fine: jruby-18.104.22.168 :001 > [1,2][0..-1] => [1, 2]
# Java array slicing with a negative index in 22.214.171.124 (last version known to work) works fine: jruby-126.96.36.199 :001 > a = [1,2].to_java[0..-1] => java.lang.Object[1, 2]@1e730495
Instead, what happens is that the last element of the Java array is lost:
# Java array slicing with a negative index in 188.8.131.52 doesn't work any more: jruby-184.108.40.206 :001 > a = [1,2].to_java[0..-1] => java.lang.Object@6a472554
Note that this issue was introduced in 220.127.116.11 and remains in the latest released version 18.104.22.168.
The text was updated successfully, but these errors were encountered:
seems like we (I most likely) did the range exclude end condition upside down :
... fix coming for 9.2.8, thanks for bringing this up