RFR 8146458 Improve exception reporting for Objects.checkIndex/checkFromToIndex/checkFromIndexSize

John Rose john.r.rose at oracle.com
Sat Jan 16 07:36:44 UTC 2016

On Jan 15, 2016, at 2:43 PM, Stuart Marks <stuart.marks at oracle.com> wrote:
> I think, in order to avoid introducing new functional interfaces, this information is funneled into a single varargs call, which has to use Integer boxes, because it then wraps its args into a List (thanks for using the new List factory!), which then has to unpack the list and check its length against the number of arguments for the particular message kind.

And that's before String.format does a bunch more steps of the same kind, including boxing and varargs. And then the exception creation itself walks the entire thread stack. Micro-optimization is hopeless. 

But it doesn't matter because it's all on the slow path. 

> I understand that this is the "slow" exception-throwing path, but my sense is still that this ought to be made simpler. Perhaps the scope of what it's trying to accomplished should be reduced, if that helps things.

Simpler would be good but I don't see it any simpler, yet. 

Do give it some thought!

More information about the core-libs-dev mailing list