added a comment - - edited
they don't have to be in an eval and there's others:
return / eval "return"
(eval):1: unexpected return (LocalJumpError) // this one works in jruby now (was considered toplevel return in previous JIRAs)
break / eval "break"
(eval):1: unexpected break (LocalJumpError)
redo / eval "redo"
(eval):1: unexpected redo (LocalJumpError)
retry / eval "retry"
1: retry outside of rescue clause
throw / eval "throw" results in:
RubyKernel.java:778:in `org.jruby.RubyKernel.rbThrow': java.lang.ArrayIndexOutOfBoundsException: 0 (NativeException)
should be: 3:in `throw': wrong number of arguments (0 for 1) (ArgumentError)
there's also warn_printf(": unexpected throw\n"); - but couldn't reproduce that.
All those errors are fixed strings in eval.c:error_handle(ex) called by eval.c:ruby_options(...), eval.c:ruby_cleanup(...) and eval.c:rb_exec_end_proc() thrown on condition: if ((status = EXEC_TAG()) != 0).
Tried to dive more into it but some things are not clear for me yet.