I'm not sure how to test this... it seems there're no unit test for caller in org.jruby.test.TestKernel and the rubyspec doesn't implement 2.0 semantics, at least for this method
Added optional length to caller() method and support for Range argument
Minor whitespace fixes
Merge branch 'master' of git://github.com/berdario/jruby
Fixed off-by-one error and handled malformed arguments
If this is only for Ruby 2.0, compatibility version needs to be considered. As written, the behavior also manifests in 1.8 and 1.9 modes.
I've got this. Making tweaks so it only affects 2.0 mode and passes tests. Thanks for the PR!
Merged as of 1fe9081 (with tweaks).