Error handling for Label construction from bad BCI

- liangchenblue at gmail.com
Mon May 20 13:36:35 UTC 2024


Hi ClassFile API subscribers,
Looking at the recent developments in ClassFile API, there are quite a few
bugfixes around AIOOBE from Label generation or not anticipating IAE from
Labels.

Currently, we aim to always throw IAE instead of IOOBE, but in this way,
malformed bcis cannot be retrieved programmatically from APIs returning
Label.

I am thinking of 2 ways to access the bad bci for a label:
1. throw a subtype of IAE that returns the bad bci index (closer to current
behavior)
2. return a dummy label (maybe create a new boundlabel type) that can
produce bad bci when used in `CodeAttribute.labelToBci`

Do you think accessing the bad bci programmatically is meaningful, and
which approach do you think is better to access the bad bci?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20240520/36923ed6/attachment.htm>


More information about the classfile-api-dev mailing list