Affects Version/s: JRuby 1.5
Fix Version/s: None
Component/s: Java Integration
Number of attachments :
This is a problem with earlier versions of jruby-rack, which has an interface org.jruby.rack.RackApplication with a getRuntime method of identical signature to our own getRuntime on IRubyObject. The implementation of that interface then provides its own getRuntime method.
Under JRuby 1.4, where the class generated for an interface impl was off to the side of the org.jruby.RubyObject class hierarchy, this worked fine. Under JRuby 1.5, where the interface impl is actually a subclass of RubyObject, getRuntime in that hierarchy is now final and so the implementation fails to load properly.
There are a few fixes required for this:
- We should have a better error when an interface method is already final in the Ruby class hierarchy (or in the extending class hierarchy for Ruby-extending-Java) rather than letting the verification error to bubble out.
- jruby-rack needs a fix; Nick Sieger has so far fixed this by dodging the interface impl logic by < java.lang.Object. this causes the impl class to not descend from RubyObject, and so getRuntime can be implemented ok. This may or may not be an ok fix; since the concrete extension logic is rather involved, it could be a performance issue. But it's not a bad fix from a functional perspective.
Since jruby-rack has already been patched for this, there's no criticality to this issue for JRuby 1.5. However we should get a better error in place for JRuby 1.6 at the latest, and potentially also prioritize getting "real class" extension logic fully functional so that jruby-rack's current fix does not incur any (potential) perf penalty.
Here is a session showing a trivial reproduction of the problem: