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

Java::JavaLang::Throwable missing full_message method #5906

davishmcclurg opened this issue Oct 4, 2019 · 1 comment · Fixed by #5908

Java::JavaLang::Throwable missing full_message method #5906

davishmcclurg opened this issue Oct 4, 2019 · 1 comment · Fixed by #5908


Copy link

davishmcclurg commented Oct 4, 2019

I don't know if this is expected behavior, but I was surprised that Java::JavaLang::Throwable does not implement full_message:

irb(main):011:0> JRUBY_VERSION
=> ""
Traceback (most recent call last):
        6: from /Users/dharsha/.rbenv/versions/jruby- `<main>'
        5: from org/jruby/ `catch'
        4: from org/jruby/ `catch'
        3: from org/jruby/ `loop'
        2: from org/jruby/ `eval'
        1: from (irb):12:in `evaluate'
NoMethodError (undefined method `full_message' for java.lang.Throwable: ugh:Java::JavaLang::Throwable)
Did you mean?  message
=> "(irb):12: ugh (StandardError)\n"
@davishmcclurg davishmcclurg changed the title Java::JavaLang::Throwable missing full_exception method Java::JavaLang::Throwable missing full_message method Oct 4, 2019
Copy link

kares commented Oct 6, 2019

throwable is the more general Java object here and Ruby exceptions are throwables :)
but yeah, the concern is valid as JRuby makes throwables Ruby Exception-like.

you could setup full_message as an alias to inspect, it would likely get merged ... (the format would be slightly different but I think its a fine start)

davishmcclurg added a commit to davishmcclurg/jruby that referenced this issue Oct 8, 2019
Since Java throwables are treated similarly to regular Ruby exceptions,
I think it makes sense to implement `full_message` for easier logging
and debugging.

This moves the `RubyException` implementation to `TraceType` so that it
can be shared with `Throwable`. I had to change the `exception` argument
type in `printBacktraceMRI` in order to support the exception-like
object that `Throwable` provides.

Closes: jruby#5906
@headius headius added this to the JRuby milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

3 participants