« Return to Thread: Java subclasses in Ruby

Re: Java subclasses in Ruby

by Charles Oliver Nutter-2 :: Rate this Message:

Reply to Author | View in Thread

backspaces wrote:

>
> Charles Oliver Nutter-2 wrote:
>> backspaces wrote:
>>> I can probably figure out a reasonable work around, but for now wanted to
>>> report what the problem is.  Possibly JRuby only is aware of advertised
>>> exceptions, for example.
>> Ok, I think I follow what's going on...but is there something JRuby's
>> not doing right or handling incorrectly here? I think maybe I missed
>> that part.
>>
>> - Charlie
>>
> Its hard to say, its clearly subtle.
>
> But the situation is this: in JRuby, the NPE is not caught by the Processing
> catch .. it "escapes" somehow and is caught by the JRuby runtime rather than
> Processing.  I.e. this piece of code in Applet:

Ok, I think I might know what's happening here. Inside JRuby, all
exceptions are RuntimeException, since that's what we pass around.
Exceptions in Java code would get wrapped as a NativeException and
propogated out. My guess is that we're probably not unwrapping and
re-throwing the contained Java exception correctly in these cases.

Maybe you could provide a test harness and we'll see if we can figure it
out. The recently-added code for extending concrete/abstract classes is
a little involved, so I haven't wrapped my brain around it, but I think
this theory is probably on the right track.

You could also test it by modifying that catch to catch everything and
see if, in fact, a RuntimeException is coming out.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

 « Return to Thread: Java subclasses in Ruby