Probably all JRuby releases since we started optimizing trivial rescues.
The exception in the following code should have a proper backtrace and not blow up in backtrace_locations.
$ jruby -e 'exception = (1 / 0) rescue $!; exception.backtrace_locations'
Unhandled Java exception: java.lang.NullPointerException
backtrace_locations at org/jruby/RubyException.java:111
It doesn't have a backtrace and it blows up. $! is not being treated as an escape condition for the exception.
Fixes #4240: Rescue optimization over-optimizes rescue body with $!
Add spec for backtrace from rescue that only captures $!.