Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.5
-
Fix Version/s: None
-
Component/s: Java Integration
-
Labels:None
-
Number of attachments :
Description
When a Java method returns an object to Ruby, which is an instance of a class, which implements an inner interface of another class, an AssertionError is thrown (when running with assertion enabled, ie. using the Java command line parameter "-ea").
It seems, that the problem is: First proxy for the class is initialized. Then its interfaces are initialized, so the inner interface is initialized. That all its surrounding types are initialized, so the outer interface is initialized. Then the the inner types of that outer type are initialized, so the inner interface is initialized again. Then the assertion "assert this.proxyModule == null;" fails.
Code to reproduce:
Java::Blubber::A.doIt
package blubber; public class A { public static Object doIt() { return new C(); } } interface B { interface BInner { } } class C implements B.BInner { }
The stacktrace is:
org/jruby/javasupport/JavaClass.java:889:in `setupInterfaceModule': java.lang.AssertionError: null (NativeException)
from org/jruby/javasupport/Java.java:377:in `getInterfaceModule'
from org/jruby/javasupport/Java.java:453:in `getProxyClass'
from org/jruby/javasupport/Java.java:354:in `getInstance'
from org/jruby/javasupport/JavaUtil.java:143:in `convertJavaToUsableRubyObject'
from org/jruby/javasupport/JavaMethod.java:586:in `convertReturn'
from org/jruby/javasupport/JavaMethod.java:502:in `invokeDirectWithExceptionHandling'
from docs/playground/run_as_ruby_app.rb:2
A real life usecase (which is a little bit more complicated..), are the swing text classes. Here the problem occurs in particular with the classes javax.swing.text.LayeredHighlighter.LayerPainter and javax.swing.text.Highlighter.HighlightPainter.
Therefore another way to reproduce the problem is to call "Java::JavaxSwing::JTextArea.new().getUI()" in JRuby.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Charles Oliver Nutter [ headius ] | |
| Resolution | Fixed [ 1 ] |
Fixed at some point.