ruby / ruby/rdoc

Support for Java classes in JRuby

Open
#1,327 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
930
Forks
465
Avg merge
3d 10h
Merged PRs (30d)
27

Description

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...)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked patch and the existing ri handling in RDoc. Determine how the --java/-j option and JRuby runtime reflection could be integrated without a plugin. Done means JRuby can display Java class methods and argument types through ri, with coverage for the new behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, ruby
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.