Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JRuby 1.0.0RC1, JRuby 1.0.0RC2
-
Fix Version/s: JRuby 1.x+
-
Component/s: Interpreter
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
For code:
eval "next 1"
Ruby output:
-e:1: (eval):1: unexpected next (LocalJumpError)
JRuby output:
Exception in thread "main" org.jruby.exceptions.JumpException
Issue Links
| This issue is related to: | ||||
| JRUBY-966 | Various issues with LocalJumpError not being created early enough |
|
|
|
The big problem here, as explained to me by Tom, is that we propagate what would be LocalJumpErrors as though they're just normal JumpExceptions. Because they're JumpExceptions instead of RaiseExceptions, they don't get caught by rescue blocks.
There are two potential fixes for this I can see:
I believe the former is the correct route, and it's likely the only way that MRI could be doing this. So we need to look at these cases one by one and determine where and when it is inappropriate to encounter them, raising a LocalJumpError instead of a JumpException in those cases.
Bumping to 1.0, since we're the only ones that have reported this. But we should fix for 1.0.
- determine at event time (when next or return or whatever happens) whether it should actually raise a LocalJumpError, perhaps because no jump target is available, or the target frame is not listed as "returnable".
- make JumpException a RaiseException of type LocalJumpError. This would slow down event processing designed to pass through rescue blocks, however, since all rescues would have to be tested against a JumpException they are not intended to handle.
I believe the former is the correct route, and it's likely the only way that MRI could be doing this. So we need to look at these cases one by one and determine where and when it is inappropriate to encounter them, raising a LocalJumpError instead of a JumpException in those cases. Bumping to 1.0, since we're the only ones that have reported this. But we should fix for 1.0.