Michael, thanks for the patch and the specs, much appreciated!
I'll take care of the specs first and then will get back to your patch. Unfortunately, your patch doesn't apply cleanly to the jruby master branch. Would it be possible for your to bring it up-to-date? And, while you at it, I'd suggest not to include in the patch all the formatting tweaks. These reformatting leads to huge patch and makes it hard to apply it cleanly, not to mention that it's just hard to review, since important changes are mixed among formatting changes.