[jruby] Compiling to bytecode w/ 9.0.4.0?

Hugh Sasse hgs at dmu.ac.uk
Thu Jan 21 22:13:20 JST 2016


Hello,
I'm using JRuby 9.0.4.0 on Windows 32 bit.
I have not got any further with trying to get my code compiled to an
executable jar file.  I have worked around my subclass of Hash
needing the []() and []=() methods using fetch() and store() instead.
However, has_key?() has me stumped, because jrubyc gives me
errors relating to the unexpected '?' character, which cannot be
name mangled into Java.  My attempts to solve this run into using
things like member? which would need to be redefined.

I read on https://github.com/jruby/jruby/wiki/JRubyCompiler
that :
"""As of late September 2007, the JRuby compiler is considered complete. 
Any features missing are to be considered bugs. As part of JRuby's test 
run, the entire Ruby standard library is compiled to Java bytecode."""

So, since I can't seem to use functions called member? or has_key? or 
include?,
but the ones in the standard library are being used and converted into 
bytecode
successfully, I am obviously doing this incorrectly.  My ability to find 
the correct
way to do this by searching the web appears inadequate as well.

So my question is, what should I have read that tells me how to get 
these methods
that I redefine myself into bytecode, and thus into an executable jar 
file, please?

Thank you,
Hugh




More information about the JRuby mailing list