Closed
Description
It looks like somewhere between 1.9.3 and 2.2.2, MRI changed its behavior around overriding String#=~
. JRuby 9.0.0.0.pre2 special-cases this behavior in:
It looks like the correct behavior is to always do a dispatch to =~
to pick up any overrides.
E.g.,
MRI 2.2.2:
> ruby -v -e 'class String; def =~(regexp); :weird_value; end; end; p "a" =~ /./'
-e:1: warning: method redefined; discarding old =~
:weird_value
JRuby 9.0.0.0.pre2:
> bin/jruby -v -e 'class String; def =~(regexp); :weird_value; end; end; p "a" =~ /./'
jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-04-30 ef1fc91 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
0