Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error class is rescued when the super class is Java::JavaLang::RuntimeException #4032

civitaspo opened this issue Jul 27, 2016 · 2 comments


Copy link

Hello. I found a buggy behaviour about error handling. If the behaviour is expected, please close the issue.


  • Incorrect error class is rescued when the super class is Java::JavaLang::RuntimeException.

Sample Code

require 'java'

class MyError1 < Java::JavaLang::RuntimeException; end
class MyError2 < Java::JavaLang::RuntimeException; end

rescue MyError2 => e
  puts "Why come here? error_class => #{e.class}, rescue MyError2."
  puts "e.kind_of?(MyError1) #=> #{e.kind_of?(MyError1)}"
  puts "e.kind_of?(MyError2) #=> #{e.kind_of?(MyError2)}"

The result is ...

Why come here? error_class => MyError1, rescue MyError2.
e.kind_of?(MyError1) #=> true
e.kind_of?(MyError2) #=> false


Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
    • jruby (2.2.2) 2015-11-12 b9fb7aa Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [darwin-x86_64]
  • Operating system and platform (e.g. uname -a)
    • Darwin o-05796-mac.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

Expected Behavior

  • I think MyError1 should not be rescued.
Copy link

kares commented Aug 13, 2016

this neither worked before (in JRuby 1.7) ... kind of a new feature for handling JI, not sure what it needs.

Copy link

thanx so much!!

@enebo enebo added this to the JRuby milestone Aug 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants