Bug report: https://sourceforge.net/p/jedit/bugs/3913/
It would be good to integrate some (more) of the BeanShell2 improvements, but I think this bug is the most egregious, liable to cause infinite loops if the user is unaware and stumbles upon it. I've attached a patch against SVN (rev 24097) that contains the fix.
applied in [r24162].
Thanks for the patch :-)
Related
Commit: [r24162]