FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[ji] support java.lang.Throwable#backtrace_locations by kares · Pull Request #9461 · jruby/jruby · GitHub

/ jruby Public

[ji] support java.lang.Throwable#backtrace_locations - #9461

Merged
kares merged 1 commit into
jruby:jruby-10.0from
kares:ji-backtrace_locations
May 27, 2026
Merged

[ji] support java.lang.Throwable#backtrace_locations#9461
kares merged 1 commit into
jruby:jruby-10.0from
kares:ji-backtrace_locations

Conversation

kares commented May 25, 2026
edited
Loading

Copy link
Copy Markdown
Member

the one thing left, in terms of Ruby exception compatibility, would be Exception#exception(str) which might be a bit tricky to fully support.

kares changed the title [feat] support java.lang.Throwable#backtrace_locations [ji] support java.lang.Throwable#backtrace_locations May 25, 2026
kares linked an issue May 25, 2026 that may be closed by this pull request
kares force-pushed the ji-backtrace_locations branch from 9e515d7 to 129df00 Compare May 25, 2026 05:56
kares force-pushed the ji-backtrace_locations branch from 129df00 to de37a96 Compare May 25, 2026 10:16

kares commented May 26, 2026

Copy link
Copy Markdown
Member Author

Based on Rails usage, as mentioned in #9458 would likely make sense to re-target this to 10.0.x

headius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Minor suggestions to clean it up a bit but generally looks fine. In the future we might want to also use our JRuby-aware stack trace processing to rewrite JIT and interpreter frames but that's out of scope here.

}

@JRubyMethod
public static IRubyObject backtrace_locations(final ThreadContext context, final IRubyObject self) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This and backtrace are very similar. Maybe share the common parts and just construct the elements differently.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yeah the preamble, but even if we dry out the loop mapping with a function you still need to return a different array.

IRubyObject[] ary = new IRubyObject[length];
for ( int i = 0; i < length; i++ ) {
ary[i] = newLocation(runtime, elements[i + offset]);
ary[i] = new Location(runtime, locationClass, elements[i + offset]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Would a new overload of newLocation make sense here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

not sure, literally would be the same as doing new Location() directly.

kares force-pushed the ji-backtrace_locations branch from de37a96 to e64e131 Compare May 27, 2026 07:40
kares changed the base branch from master to jruby-10.0 May 27, 2026 07:40
kares added this to the JRuby 10.0.6.0 milestone May 27, 2026
kares merged commit 6d7819e into jruby:jruby-10.0 May 27, 2026
217 of 220 checks passed
kares deleted the ji-backtrace_locations branch May 27, 2026 09:34
chadlwilson pushed a commit to chadlwilson/jruby that referenced this pull request May 28, 2026
(cherry-picked from commit 6d7819e)

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
chadlwilson pushed a commit to chadlwilson/jruby that referenced this pull request May 28, 2026
(cherry-picked from commit 6d7819e)

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
chadlwilson pushed a commit to chadlwilson/jruby that referenced this pull request May 28, 2026
(cherry-picked from commit 6d7819e)

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
headius added a commit that referenced this pull request May 28, 2026
…e-locations

[9.4] backport [ji] support java.lang.Throwable#backtrace_locations (#9461)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support backtrace_locations with Java exceptions

2 participants


Back | FazBrowse Home | New Git URL