jruby-rack icon indicating copy to clipboard operation
jruby-rack copied to clipboard

Eliminate use of deprecated methods from JRuby

Open headius opened this issue 1 year ago • 4 comments

There are uses of many methods that have been deprecated in JRuby, some for years and some recently. We should audit these deprecations and try to safely move to the replacement options.

Known issues:

  • RubyString.cat19, deprecated in JRuby 9.4.7.0 and replaced with catWithCodeRange. Probably update after JRuby 10 is released because many users are still on earlier JRuby versions. See https://github.com/jruby/jruby-rack/pull/262#issuecomment-2503936053.

headius avatar Nov 27 '24 19:11 headius

for the record catWithCodeRange was added in 9.4.7.0 and isn't available in older JRuby versions

kares avatar May 31 '25 09:05 kares

Ahh OK, so if we do this, we wouldn't be dropping support for 9.4.x entirely. That's not so bad. 9.4.7.0 is a year old now, and patch releases have been pretty backward compatible/stable on the 9.4.x range, so maybe OK to do this for 1.3.x?

chadlwilson avatar May 31 '25 09:05 chadlwilson

it's a bit unfortunate to support only a sub-set of 9.4 but than why not get rid of the method-handle work-around sooner...

maybe we should figure out a way to let users now they need to upgrade their 9.4 patch version, not sure how much work that is atm. we could just catch java.lang.NoSuchMethodError check the message and re-throw it as another error if it matches java.lang.NoSuchMethodError: org.jruby.RubyString.catWithCodeRange(Lorg/jruby/util/ByteList;I)I (seems unlikely we would need to use the catWithCodeRange API elsewhere 🤷)

kares avatar May 31 '25 09:05 kares

Perhaps I don't have quite the necessary sympathy for those who don't patch their dependencies - at the very least for security reasons ;-)

chadlwilson avatar May 31 '25 09:05 chadlwilson