Skip to content

Support for Java classes in JRuby #1327

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

Open
headius opened this issue Mar 23, 2025 · 0 comments
Open

Support for Java classes in JRuby #1327

headius opened this issue Mar 23, 2025 · 0 comments

Comments

@headius
Copy link
Contributor

headius commented Mar 23, 2025

I was recently reminded of a patch I threw together 15 years ago to support documenting Java classes with ri in JRuby. Today I found that patch:

https://gist.github.com/headius/276803

This is a very loose concept based on rdoc from 2010, but the logic should still work today. When the --java or -j flag is passed, instead of using the usual stores for docs, we use runtime reflection to load the class and method(s) in question. The compiled code available at runtime does not have text documentation, but we can still display the method names and argument types, which would be a big help for JRuby users.

As this is very specific to JRuby, I wanted to ask how we might get an updated version of this patch integrated. I could not see a good way to do a JRuby-specific plugin, but I have not dug very deep.

It could also simply be added as a feature that is only available when running on JRuby.

An example of the output:

~/projects/jruby ➔ ri -j java.lang.Object
------------------------------------------------ Class: java.lang.Object
     (no description...)
------------------------------------------------------------------------


Instance methods:
-----------------
     equals, getClass, hashCode, notify, notifyAll, toString, wait

~~/projects/jruby ➔ ri -j java.lang.String.split
------------------------------------------------- java.lang.String#split
     split(java.lang.String,int) => java.lang.String[]
     split(java.lang.String) => java.lang.String[]
------------------------------------------------------------------------
     (no description...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant